【GP集群部署】GP集群切换测试

GP集群切换测试:
1.确定集群状态
t3-ze-app09为standby master节点,t3-ze-app11是master节点
$ gpstate -a
20211102:09:37:58:023988 gpstate:t3-ze-app11:greenplum-[INFO]:-Starting gpstate with args: -a
20211102:09:37:58:023988 gpstate:t3-ze-app11:greenplum-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.0.0-beta.1 build dev'
20211102:09:37:58:023988 gpstate:t3-ze-app11:greenplum-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.0.0-beta.1 build dev) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit compiled on Oct 15 2021 17:22:58'
20211102:09:37:58:023988 gpstate:t3-ze-app11:greenplum-[INFO]:-Obtaining Segment details from master...
20211102:09:37:58:023988 gpstate:t3-ze-app11:greenplum-[INFO]:-Gathering data from segments...
20211102:09:37:59:023988 gpstate:t3-ze-app11:greenplum-[INFO]:-Greenplum instance status summary
20211102:09:37:59:023988 gpstate:t3-ze-app11:greenplum-[INFO]:-----------------------------------------------------
20211102:09:37:59:023988 gpstate:t3-ze-app11:greenplum-[INFO]:- Master instance = Active
20211102:09:37:59:023988 gpstate:t3-ze-app11:greenplum-[INFO]:- Master standby = t3-ze-app09
20211102:09:37:59:023988 gpstate:t3-ze-app11:greenplum-[INFO]:- Standby master state = Standby host passive
20211102:09:37:59:023988 gpstate:t3-ze-app11:greenplum-[INFO]:- Total segment instance count from metadata = 16

[greenplum@t3-ze-app11 ~]$ gpstate -c
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:-Starting gpstate with args: -c
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.0.0-beta.1 build dev'
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.0.0-beta.1 build dev) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit compiled on Oct 15 2021 17:22:58'
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:-Obtaining Segment details from master...
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:--------------------------------------------------------------
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:--Current GPDB mirror list and status
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:--Type = Group
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:--------------------------------------------------------------
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Status Data State Primary Datadir Port Mirror Datadir Port
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Primary Active, Mirror Available Synchronized t3-ze-app09 /home/greenplum/gpbase/gpdatap1/gpseg0 3300 t3-ze-app11 /home/greenplum/gpbase/gpdatam1/gpseg0 4300
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Primary Active, Mirror Available Synchronized t3-ze-app09 /home/greenplum/gpbase/gpdatap2/gpseg1 3301 t3-ze-app11 /home/greenplum/gpbase/gpdatam2/gpseg1 4301
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Primary Active, Mirror Available Synchronized t3-ze-app11 /home/greenplum/gpbase/gpdatap1/gpseg2 3300 t3-ze-app12 /home/greenplum/gpbase/gpdatam1/gpseg2 4300
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Primary Active, Mirror Available Synchronized t3-ze-app11 /home/greenplum/gpbase/gpdatap2/gpseg3 3301 t3-ze-app12 /home/greenplum/gpbase/gpdatam2/gpseg3 4301
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Primary Active, Mirror Available Synchronized t3-ze-app12 /home/greenplum/gpbase/gpdatap1/gpseg4 3300 t3-ze-app13 /home/greenplum/gpbase/gpdatam1/gpseg4 4300
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Primary Active, Mirror Available Synchronized t3-ze-app12 /home/greenplum/gpbase/gpdatap2/gpseg5 3301 t3-ze-app13 /home/greenplum/gpbase/gpdatam2/gpseg5 4301
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Primary Active, Mirror Available Synchronized t3-ze-app13 /home/greenplum/gpbase/gpdatap1/gpseg6 3300 t3-ze-app09 /home/greenplum/gpbase/gpdatam1/gpseg6 4300
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:- Primary Active, Mirror Available Synchronized t3-ze-app13 /home/greenplum/gpbase/gpdatap2/gpseg7 3301 t3-ze-app09 /home/greenplum/gpbase/gpdatam2/gpseg7 4301
20211102:09:37:46:023917 gpstate:t3-ze-app11:greenplum-[INFO]:--------------------------------------------------------------

2.关闭master节点
[greenplum@t3-ze-app11 ~]$ gpstop -m
20211102:09:40:16:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Starting gpstop with args: -m
20211102:09:40:16:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Gathering information and validating the environment...
20211102:09:40:16:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Obtaining Greenplum Master catalog information
20211102:09:40:16:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Obtaining Segment details from master...
20211102:09:40:16:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 6.0.0-beta.1 build dev'

Continue with master-only shutdown Yy|Nn (default=N):
> y
20211102:09:40:18:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Commencing Master instance shutdown with mode='smart'
20211102:09:40:18:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Master segment instance directory=/home/greenplum/gpbase/gpmaster/gpseg-1
20211102:09:40:18:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Stopping master segment and waiting for user connections to finish ...
server shutting down
20211102:09:40:19:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Attempting forceful termination of any leftover master process
20211102:09:40:19:024460 gpstop:t3-ze-app11:greenplum-[INFO]:-Terminating processes for segment /home/greenplum/gpbase/gpmaster/gpseg-1

3.t3-ze-app11是master节点,激活standby master节点t3-ze-app09,
gpactivatestandby -d $MASTER_DATA_DIRECTORY
[greenplum@t3-ze-app09 gpseg-1]$ gpactivatestandby -d /home/greenplum/gpbase/gpmaster/gpseg-1/
检查下集群的状态
[greenplum@t3-ze-app09 gpseg-1]$$gpstate -a

4.将旧的master节点加入到GP集群,并作为standby master
清理掉之前旧的master的master catalog目录
[greenplum@t3-ze-app11 gpmaster]$ mv gpseg-1 gpseg-1.bk
[greenplum@t3-ze-app11 gpmaster]$ ll
total 8
drwx------ 22 greenplum greenplum 4096 Nov 2 09:41 gpseg-1
drwx------ 22 greenplum greenplum 4096 Nov 2 09:40 gpseg-1.bk
在新的master节点,将旧master
[greenplum@t3-ze-app09 ~]$gpinitstandby -s t3-ze-app11

 

posted on 2021-11-02 11:05  HelonTian  阅读(177)  评论(0编辑  收藏  举报