1. 集群可以配置成这种形式:
1个gtm节点,1个gtm_standby, 多个coordinator,多个datanode (用postgres-xc1.1版本验证没问题)
初始化各个节点
(1) gtm
(1) 首先启动gtm 节点:
log日志信息:
1:3087861440:2014-02-07 15:24:28.257 CST -LOG: Saving transaction restoration info, backed-up gxid: 12004
LOCATION: GTM_WriteRestorePointXid, gtm_txn.c:2649
2:3087861440:2014-02-07 15:24:28.258 CST -LOG: Started to run as GTM-Active.
LOCATION: main, main.c:641
(2) 启动gtm_standby
log日志信息:
1:3087738560:2014-02-07 15:25:15.591 CST -LOG: Connecting the GTM active on 127.0.0.1:5330...
LOCATION: gtm_standby_connectToActiveGTM, gtm_standby.c:514
2:3087738560:2014-02-07 15:25:15.592 CST -LOG: Connection established to the GTM active.
LOCATION: gtm_standby_start_startup, gtm_standby.c:51
3:3087738560:2014-02-07 15:25:15.592 CST -LOG: Startup connection established with active-GTM.
LOCATION: main, main.c:560
GTMPQgetResult() done.
4:3087738560:2014-02-07 15:25:15.593 CST -LOG: Saving transaction restoration info, backed-up gxid: 12004
LOCATION: GTM_WriteRestorePointXid, gtm_txn.c:2649
5:3087738560:2014-02-07 15:25:15.595 CST -LOG: Started to run as GTM-Standby.
LOCATION: main, main.c:635
6:3087738560:2014-02-07 15:25:15.596 CST -LOG: Startup connection with the active-GTM closed.
LOCATION: main, main.c:710
后头再看gtm的log信息,如下:
1:3087861440:2014-02-07 15:24:28.257 CST -LOG: Saving transaction restoration info, backed-up gxid: 12004
LOCATION: GTM_WriteRestorePointXid, gtm_txn.c:2649
2:3087861440:2014-02-07 15:24:28.258 CST -LOG: Started to run as GTM-Active.
LOCATION: main, main.c:641
3:3087861440:2014-02-07 15:25:15.591 CST -LOG: Any GTM standby node not found in registered node(s).
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:381
1:3087858576:2014-02-07 15:25:15.595 CST -LOG: Failed to establish a connection with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:396
2:3087858576:2014-02-07 15:25:15.597 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
(3) 启动coordinator节点
pg_log下日志信息:
LOG: database system was interrupted; last known up at 2014-02-07 15:14:03 CST
LOG: database system was not properly shut down; automatic recovery in progress
LOG: redo starts at 0/1807CB0
LOG: record with zero length at 0/181B250
LOG: redo done at 0/181B228
LOG: last completed transaction was at log time 2014-02-07 15:16:03.150286+08
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
回头再看gtm日志信息:
1:3087861440:2014-02-07 15:24:28.257 CST -LOG: Saving transaction restoration info, backed-up gxid: 12004
LOCATION: GTM_WriteRestorePointXid, gtm_txn.c:2649
2:3087861440:2014-02-07 15:24:28.258 CST -LOG: Started to run as GTM-Active.
LOCATION: main, main.c:641
3:3087861440:2014-02-07 15:25:15.591 CST -LOG: Any GTM standby node not found in registered node(s).
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:381
1:3087858576:2014-02-07 15:25:15.595 CST -LOG: Failed to establish a connection with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:396
2:3087858576:2014-02-07 15:25:15.597 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
1:3087861440:2014-02-07 15:28:43.201 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
2:3087861440:2014-02-07 15:29:43.215 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
3:3087861440:2014-02-07 15:30:43.231 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
以及gtm_standby日志信息:没发生变化
(4) 启动datanode节点
pg_log下日志信息:
LOG: database system was interrupted; last known up at 2014-02-07 15:13:32 CST
LOG: database system was not properly shut down; automatic recovery in progress
LOG: redo starts at 0/1806464
LOG: record with zero length at 0/1818834
LOG: redo done at 0/181880C
LOG: last completed transaction was at log time 2014-02-07 15:15:32.330782+08
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
回头再看gtm日志信息:
1:3087861440:2014-02-07 15:24:28.257 CST -LOG: Saving transaction restoration info, backed-up gxid: 12004
LOCATION: GTM_WriteRestorePointXid, gtm_txn.c:2649
2:3087861440:2014-02-07 15:24:28.258 CST -LOG: Started to run as GTM-Active.
LOCATION: main, main.c:641
3:3087861440:2014-02-07 15:25:15.591 CST -LOG: Any GTM standby node not found in registered node(s).
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:381
1:3087858576:2014-02-07 15:25:15.595 CST -LOG: Failed to establish a connection with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:396
2:3087858576:2014-02-07 15:25:15.597 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
1:3087861440:2014-02-07 15:28:43.201 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
2:3087861440:2014-02-07 15:29:43.215 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
3:3087861440:2014-02-07 15:30:43.231 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
4:3087861440:2014-02-07 15:31:43.246 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
5:3087861440:2014-02-07 15:32:43.261 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
6:3087861440:2014-02-07 15:33:43.278 CST -LOG: Connection established with GTM standby. - 0x9d62338
LOCATION: gtm_standby_connect_to_standby_int, gtm_standby.c:400
参考:
1.pgxc_ha配置和切换
http://wenku.baidu.com/view/f6987f1bfad6195f312ba670.html、