路由配置
cn01
[tbase@VM_0_29_centos ~]# psql -h 172.16.0.29 -p 15432 -d postgres -U tbase
psql (PostgreSQL 10.0 TBase V2)
Type "help" for help.
postgres=#
alter node cn01 with (host='172.16.0.29',port=15432);
create node cn02 with (type=coordinator,host='172.16.0.47',port=15432,primary=false,preferred=false);
create node dn01 with (type=datanode,host='172.16.0.29',port=23001,primary=false,preferred=false);
create node dn02 with (type=datanode,host='172.16.0.47',port=23002,primary=false,preferred=false);
select pgxc_pool_reload();
cn02
[tbase@VM_0_29_centos ~]# psql -h 172.16.0.47 -p 15432 -d postgres -U tbase
psql (PostgreSQL 10.0 TBase V2)
Type "help" for help.
postgres=#
alter node cn02 with (host='172.16.0.47',port=15432);
create node cn01 with (type=coordinator,host='172.16.0.29',port=15432,primary=false,preferred=false);
create node dn01 with (type=datanode,host='172.16.0.29',port=23001,primary=false,preferred=false);
create node dn02 with (type=datanode,host='172.16.0.47',port=23002,primary=false,preferred=false);
select pgxc_pool_reload();
dn01
[tbase@VM_0_29_centos ~]# psql -h 172.16.0.29 -p 23001 -d postgres -U tbase
psql (PostgreSQL 10.0 TBase V2)
Type "help" for help.
postgres=#
alter node dn01 with (host='172.16.0.29',port=23001);
create node cn01 with (type=coordinator,host='172.16.0.29',port=15432,primary=false,preferred=false);
create node cn02 with (type=coordinator,host='172.16.0.47',port=15432,primary=false,preferred=false);
create node dn02 with (type=datanode,host='172.16.0.47',port=23002,primary=false,preferred=false);
select pgxc_pool_reload();
dn02
[tbase@VM_0_29_centos ~]# psql -h 172.16.0.47 -p 23002 -d postgres -U tbase
psql (PostgreSQL 10.0 TBase V2)
Type "help" for help.
postgres=#
alter node dn02 with (host='172.16.0.47',port=23001);
create node cn01 with (type=coordinator,host='172.16.0.29',port=15432,primary=false,preferred=false);
create node cn02 with (type=coordinator,host='172.16.0.47',port=15432,primary=false,preferred=false);
create node dn01 with (type=datanode,host='172.16.0.29',port=23001,primary=false,preferred=false);
select pgxc_pool_reload();
路由表信息
所有节点的路由信息配置完成后如下所示
[tbase@VM_0_29_centos ~]# psql -h 172.16.0.29 -p 15432 -d postgres -U tbase
postgres=# select * from pgxc_node;
node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id | node_cluster_name
-----------+-----------+-----------+-------------+----------------+------------------+-------------+-------------------
gtm_1 | G | 21000 | 172.16.0.29 | t | f | -1500995709 | tbase_cluster
cn01 | C | 15432 | 172.16.0.29 | f | f | 53994174 | tbase_cluster
cn02 | C | 15432 | 172.16.0.47 | f | f | -613255070 | tbase_cluster
dn01 | D | 23001 | 172.16.0.29 | f | f | -1085152094 | tbase_cluster
dn02 | D | 23002 | 172.16.0.47 | f | f | -506537247 | tbase_cluster
(5 rows)