Postgres-XC : Shutting Down and Starting Up

今天总结下 Postgres-XC 的关闭与开启,由于 Postgres-XC 体系比较复杂,组件较多,在关闭的时候需要保持所有节点事务的一致性,所以需要小心,关于 Postgres-XC 的关闭与开启总结如下。

Postgres-XC 关闭步骤

  1. shutdown all datanode
  2. shutdown all coordinate
  3. shutdown all gtm_proxy
  4. shutdown all gtm_stnadby if exists
  5. shutdown all gtm

Postgres-XC 开启步骤

  1. startup gtm
  2. startup gtm_standby if exists
  3. startup gtm_proxy if exists
  4. startup all datanode
  5. startup all coordinator
    备注:以上是 Postgres-XC 关闭与开启的步骤,下面通过实验具体演示下。

Postgres-XC 关闭测试

1
2
3
4
5
6
7
8
9
10
11
12
13
1 stop datanode
pg_ctl stop -Z datanode -m fast -D /pgdata_xc/db_1/pg_root
pg_ctl stop -Z datanode -m fast -D /pgdata_xc/db_2/pg_root

2 stop coordinator
pg_ctl stop -Z coordinator -m fast -D /database/1922/pgdata1/pgdata_xc/coord1
pg_ctl stop -Z coordinator -m fast -D /database/1922/pgdata1/pgdata_xc/coord2

3 stop gtm_stnadby
gtm_ctl stop -m fast -S gtm -D /pgdata_xc/gtm_standby

4 stop gtm
gtm_ctl stop -m fast -S gtm -D /database/1922/pgdata1/pgdata_xc/gtm

Postgres-XC 开启测试

1
2
3
4
5
6
7
8
9
10
11
12
13
1 start gtm
gtm -D /database/1922/pgdata1/pgdata_xc/gtm &

2 start gtm_standby
gtm -D /pgdata_xc/gtm_standby &

3 start datanode
postgres -X -D /pgdata_xc/db_1/pg_root -p 15431 -i &
postgres -X -D /pgdata_xc/db_2/pg_root -p 15432 -i &

4 start coordinator
postgres -C -D /database/1922/pgdata1/pgdata_xc/coord1 -p 1921 -i &
postgres -C -D /database/1922/pgdata1/pgdata_xc/coord2 -p 1925 -i &

附:GTM 配置

今天在测试 Postgres-XC 关闭和启动时,新增加了 gtm_standby 组件,关于 Postgres-XC 的安装可参考之前的BLOG:https://postgres.fun/20120603152309.html , 这里贴下 gtm 和 gtm_standby 配置。

3.1 附 gtm 配置参数

1
2
3
4
5
6
7
nodename = 'gtm' # Specifies the node name.  
# (changes requires restart)
listen_addresses = '*' # Listen addresses of this GTM.
# (changes requires restart)
port = 6666 # Port number of this GTM.
# (changes requires restart)
startup = ACT # Start mode. ACT/STANDBY.

3.2 附 gtm_standby 配置参数

1
2
3
4
5
6
7
8
9
10
11
nodename = 'gtm_stnadby' # Specifies the node name.  
# (changes requires restart)
listen_addresses = '*' # Listen addresses of this GTM.
# (changes requires restart)
port = 6666 # Port number of this GTM.
# (changes requires restart)
startup = STANDBY # Start mode. ACT/STANDBY.
active_host = '192.168.1.35' # Listen address of active GTM.
# (changes requires restart)
active_port =6666 # Port number of active GTM.
# (changes requires restart)

参考

最后推荐和张文升共同编写的《PostgreSQL实战》,本书基于PostgreSQL 10 编写,共18章,重点介绍SQL高级特性、并行查询、分区表、物理复制、逻辑复制、备份恢复、高可用、性能优化、PostGIS等,涵盖大量实战用例!

购买链接:https://item.jd.com/12405774.html

PostgreSQL实战
感谢支持!
0%