standby master的模拟故障与修复
本文档主要演示GreenPlum数据库的Master节点的Standby在异常后的数据同步及Master节点故障后,Standby的切换。在操作前通过gpstate命令查看Standby的状态是正常的,数据也在同步状态。同时将现有master(原有的standy)和原有的master再做切换,恢复原状。
1 检查集群gpstate -f
[gpadmin@mdw ~]$ gpstate -f 20200420:00:23:47:010679 gpstate:mdw:gpadmin-[INFO]:-Starting gpstate with args: -f 20200420:00:23:47:010679 gpstate:mdw:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 5.10.2 build commit:b3c02f3acd880e2d676dacea36be015e4a3826d4' 20200420:00:23:47:010679 gpstate:mdw:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.3.23 (Greenplum Database 5.10.2 build commit:b3c02f3acd880e2d676dacea36be015e4a3826d4) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Aug 10 2018 07:30:24' 20200420:00:23:47:010679 gpstate:mdw:gpadmin-[INFO]:-Obtaining Segment details from master... 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:-Standby master details 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:----------------------- 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:- Standby address = smdw 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:- Standby data directory = /greenplum/gpdata/master/gpseg-1 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:- Standby port = 5432 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:- Standby PID = 7593 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:- Standby status = Standby host passive 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:-------------------------------------------------------------- 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:--pg_stat_replication 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:-------------------------------------------------------------- 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:--WAL Sender State: streaming 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:--Sync state: sync 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:--Sent Location: 0/CADFDD8 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:--Flush Location: 0/CADFDD8 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:--Replay Location: 0/CADFDD8 20200420:00:23:48:010679 gpstate:mdw:gpadmin-[INFO]:--------------------------------------------------------------2 模拟standby 故障
mdw cat .bash_profile export PATH export MASTER_DATA_DIRECTORY=/greenplum/gpdata/master/gpseg-1 source /usr/local/greenplum-db/greenplum_path.sh export PGPORT=5432 export PGDATABASE=archdata sdw3 and smdw vi .bash_profile export MASTER_DATA_DIRECTORY=/greenplum/gpdata/master/gpseg-1 source /usr/local/greenplum-db/greenplum_path.sh export PGPORT=5432 export PGDATABASE=archdata vi .bashr export MASTER_DATA_DIRECTORY=/greenplum/gpdata/master/gpseg-1 source /usr/local/greenplum-db/greenplum_path.sh export PGPORT=5432 export PGDATABASE=archdata smdw: pg_ctl stop -D $MASTER_DATA_DIRECTORY [gpadmin@sdw3 ~]$ pg_ctl stop -D $MASTER_DATA_DIRECTORY waiting for server to shut down.... done server stopped [gpadmin@sdw3 ~]$3 mdw上检查集群状态
gpstate -f
[gpadmin@mdw ~]$ gpstate -f 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:-Starting gpstate with args: -f 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 5.10.2 build commit:b3c02f3acd880e2d676dacea36be015e4a3826d4' 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.3.23 (Greenplum Database 5.10.2 build commit:b3c02f3acd880e2d676dacea36be015e4a3826d4) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Aug 10 2018 07:30:24' 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:-Obtaining Segment details from master... 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:-Standby master details 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:----------------------- 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:- Standby address = smdw 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:- Standby data directory = /greenplum/gpdata/master/gpseg-1 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:- Standby port = 5432 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[WARNING]:-Standby PID = 0 <<<<<<<< 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[WARNING]:-Standby status = Standby process not running <<<<<<<< 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:-------------------------------------------------------------- 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:--pg_stat_replication 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:-------------------------------------------------------------- 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:-No entries found. 20200420:01:03:58:011908 gpstate:mdw:gpadmin-[INFO]:----------------------
Greenplum实战--standby master的模拟故障与修复
最新推荐文章于 2022-01-13 15:00:53 发布
本文详细介绍了在Greenplum数据库中,Master节点的Standby在异常情况下的数据同步修复流程,包括故障模拟、状态检查、数据同步及Master节点故障后的Standby切换,为数据库维护人员提供了实用的操作指南。

最低0.47元/天 解锁文章
4527

被折叠的 条评论
为什么被折叠?



