2190 2088 0 22:14 pts/0 00:00:00 ps -ef
pgxc 2191 2088 0 22:14 pts/0 00:00:00 grep pgxc
?
?
5.在172.16.0.134主机启动coordinator
[pgxc@postgresql01 ~]$ pg_ctl start -D /coordinator/cd1 -Z coordinator
[pgxc@postgresql01 ~]$ pg_ctl start -D /coordinator/cd2 -Z coordinator
6.查看是否成功
[pgxc@postgresql01 ~]$ ps -ef | grep pgxc
root 2055 2036 0 21:42 pts/0 00:00:00 su - pgxc
pgxc 2056 2055 0 21:42 pts/0 00:00:00 -bash
pgxc 2153 2056 0 22:11 pts/0 00:00:00 gtm -D /gtm
pgxc 2168 1 0 22:16 pts/0 00:00:00 /opt/pgxc/bin/postgres --coordinator -D /coordinator/cd1
pgxc 2170 2168 0 22:16 ? 00:00:00 postgres: pooler process
pgxc 2171 2168 0 22:16 ? 00:00:00 postgres: checkpointer process
pgxc 2172 2168 0 22:16 ? 00:00:00 postgres: writer process
pgxc 2173 2168 0 22:16 ? 00:00:00 postgres: wal writer process
pgxc 2174 2168 0 22:16 ? 00:00:00 postgres: autovacuum launcher process
pgxc 2175 2168 0 22:16 ? 00:00:00 postgres: stats collector process
pgxc 2180 1 0 22:17 pts/0 00:00:00 /opt/pgxc/bin/postgres --coordinator -D /coordinator/cd2
pgxc 2182 2180 0 22:17 ? 00:00:00 postgres: pooler process
pgxc 2183 2180 0 22:17 ? 00:00:00 postgres: checkpointer process
pgxc 2184 2180 0 22:17 ? 00:00:00 postgres: writer process
pgxc 2185 2180 0 22:17 ? 00:00:00 postgres: wal writer process
pgxc 2186 2180 0 22:17 ? 00:00:00 postgres: autovacuum launcher process
pgxc 2187 2180 0 22:17 ? 00:00:00 postgres: stats collector process
pgxc 2201 2056 0 22:17 pts/0 00:00:00 ps -ef
pgxc 2202 2056 0 22:17 pts/0 00:00:00 grep pgxc
?
九、配置集群节点信息
在172.16.0.134配置集群信息
[pgxc@postgresql01 ~]$ psql -p1921 postgres
psql (PGXC , based on PG 9.3.2)
Type "help" for help.
?
postgres=#select * from pgxc_node;
node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id
-----------+-----------+-----------+--------------+----------------+------------------+-------------
coord1 | C | 5432 | localhost | f | f | 1885696643
?
postgres=# create node db1 with(type='datanode',host='172.16.0.135',port=15431,primary,preferred);
?
postgres=# create node db2 with(type='datanode',host='172.16.0.135',port=15432);
?
postgres=# create node coord2 with(type='coordinator',host='172.16.0.134',port=1925);
?
?
postgres=# select * from pgxc_node;
node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id
-----------+-----------+-----------+--------------+----------------+------------------+-------------
coord1 | C | 5432 | localhost | f | f | 1885696643
db1 | D | 15431 | 172.16.0.135 | t | t | -2885965
db2 | D | 15432 | 172.16.0.135 | f | f | -79866771
coord2 | C | 1925 | 172.16.0.134 | f | f | -1197102633
?
postgres=# select pgxc_pool_reload();
?
十、测试
[pgxc@postgresql01 ~]$ psql -p 1921 postgres
psql (PGXC , based on PG 9.3.2)
Type "help" for help.
?
postgres=# select * from pgxc_node;
node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id
-----------+-----------+-----------+--------------+----------------+------------------+-------------
coord1 | C | 5432 | localhost | f | f | 1885696643
db1 | D | 15431 | 172.16.0.135 | t | t | -2885965
db2 | D | 15432 | 172.16.0.135 | f | f | -79866771
coord2 | C | 1925 | 172.16.0.134 | f | f | -1197102633
?
postgres=# create database test_xc;
CREATE DATABASE
?
postgres=#
?
说明上面成功
?