2220
/*
killing cluster (pid:29741
29745
29746
29747
29748
29749)
done
cluster is not running on this server
init_pg_companion -> true
foreground -> true
[0] CLUSTER master port: 2220 (0)
[0] CLUSTER slave count: 1 (0)
[0] N1 --------- NEW CONNECTION ------------ CACHE SIZE : 0 / 0 (0)
[0] N1 connecting to localhost : 2219 (0)
[0] N1 -> authentication; (0)
[0] N1 <- data ( 103 ms ) (0)
[0] N1 -> exec show_data_model(); (0)
[0] N1 <- data ( 1 ms ) (0)
proxy server connect undefined
-------> conn1
-------> conn2
-------> get tables
-------> drop table v_fidelity_cards
-------> drop table v_item_customer_infos
-------> drop table v_item_tags
-------> drop table v_items
-------> drop table v_sales
-------> fn
-------> create table v_fidelity_cards
table v_item_customer_infos created C|CREATE TABLE[0]
-------> create table v_items
table v_item_customer_infos created C|CREATE TABLE[0]
-------> create table v_sales
table v_item_customer_infos created C|CREATE TABLE[0]
-------> create table v_item_tags
table v_item_customer_infos created C|CREATE TABLE[0]
-------> create table v_item_customer_infos
table v_item_customer_infos created C|CREATE TABLE[0]
-------> commit
-------> insert v_fidelity_cards, 3 lines
-------> insert v_items, 3 lines
-------> insert v_sales, 3 lines
-------> insert v_item_tags, 3 lines
no more calls
*/
/*
cluster is not running on this server
archiving previous log file
purging log archive (7 days)
starting stormbase cluster .. OK: cluster listening on tcp port 2220
*/
/*
PID: 30157, CMD: STORMBASE, TCP_PORT: 2219
PID: 30244, CMD: CLUSTER, TCP_PORT: 2220
PID: 30248, CMD: CLUSTER, TCP_PORT: 2220
PID: 30249, CMD: CLUSTER, TCP_PORT: 2220
PID: 30250, CMD: CLUSTER, TCP_PORT: 2220
PID: 30251, CMD: CLUSTER, TCP_PORT: 2220
PID: 30252, CMD: CLUSTER, TCP_PORT: 2220
*/
Pg_companion
Pre requisite: one Postgresql (PG) instance running somewhere (the PG companion)
You can use PG driver to query SB
Query steps: PG client -> SB cluster -> SB and PG companion -> pgsql client
SB cluster will reply to pgsql client will a "mix" of SB and PG responses
Only queries compatible with PG are supported in this mode
init cluster
The goal is to create SB's data model in PG companion
02_sql> ./cluster.sh init_pg_companion;
start cluster
Start SB cluster in companion mode
02_sql> ./cluster.sh start|bounce;
query cluster
select
count(line_id) from
v_sales;
count
3
(1 row)
select
count(line_id) from
v_sales;
count
7
(1 row)
select
item_id,customer_id,sales_date,sales_qty,line_id from
v_sales;
item_id | customer_id | sales_date | sales_qty | line_id
artA | C1 | 20191231 | 5 | ID01
artB | C2 | 20200102 | 6 | ID02
artB | C1 | 20191231 | 4 | ID03
artB | C2 | 20200102 | 7 | ID04
artA | C1 | 20191231 | 5 | ID06
| C1 | 20200102 | 8 | ID05
artA | C2 | 20191231 | 5 | ID07
(7 rows)