恢复故障的Master
如果主Master故障,Greenplum数据库不可访问且WAL复制会停止。使用[gpactivatestandby](../../../utility_guide/admin_utilities/gpactivatestandby.html)
来激活后备Master。
在激活后备Master过程中,Greenplum数据库会重构Master主机为最后一次成功提交事务时的状态。
以下步骤假设系统中已经配置了standby master主机。详见启用Master镜像。
激活standby master
- 在standby master主机上运行
gpactivatestandby
工具 来激活它。例如:
$ gpactivatestandby -d /data/master/gpseg-1
此处-d
选项指定正在激活的master主机的数据目录。
激活standby后,状态变为active或primary master
- 上面工具执行完成后,运行
gpstate
带有-b
选项来显示系统汇总信息:
$ gpstate -b
master实例状态应该为Active
。
如果没有配置standby master,该命令会显示standby master的状态为
No master standby configured
。如果配置了standby master,它的状态为
Passive
。
- 在切换到最新的活动Master主机后,在其上运行
ANALYZE
例如:$ psql dbname -c 'ANALYZE;'
- 可选:如果激活之前的standby master时没有配置一个新的standby master。可以运行
gpinitstandby
工具来配置激活一个新的standby master。
Important: 必须初始化一个新的standby master以继续为master提供镜像。 关于恢复原来master和standby master的详细配置方法,请见在恢复后还原Master镜像。
Parent topic: 启用高可用和数据持久化特征