原文:http://blog.osdba.net/?post=58
情况一:
当一台segment机器坏了,然后机器又恢复了,或某一个segment数据库停了
只需要运行gprecoverseg,就可以把segment恢复过来:
gprecoverseg
运行gprecoverseg之后,需要运行gpstate -m查看同步是否都完成了。
如果一个primary的segment失败后,mirror segment会升级成primary segment,然后集群可以正常运行。原先失败的primary segment的机器恢复后,使用gprecoverseg恢复这个segment后,这个原先的primary segment会变成mirror segment,如果想让原先的失败的primary segment,在恢复后仍然能成为primary segment,则需要重启集群。
具体方法为:
1. 运行gpstate -m 确保所有的mirror segment都与primary segment同步了:
$ gpstate -m
如果还没有同步完成,请等待到同步完成。
2. 重启greenplum
$ gpstop -r
[gpadmin@mdw ~]$ gpstate -f
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:-Starting gpstate with args: -f
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.2.2.0 build 6'
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.2.2.0 build 6) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Jul 1 2012 11:15:14'
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:-Standby master instance not configured
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:--------------------------------------------------------------
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:--gp_master_mirroring table
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:--------------------------------------------------------------
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:--Summary state: Not Configured
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:--Detail state:
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:--Log time:
20120927:23:42:19:001333 gpstate:mdw:gpadmin-[INFO]:--------------------------------------------------------------
[gpadmin@mdw ~]$