生成配置
gpaddmirrors -o /usr/local/greenplum-db/gpmirrors_config
查看生成配置文件
vim gpmirrors_config
0|chen-es02|7000|/data/greenplum/data1/mirror/gpseg0
1|chen-es02|7001|/data/greenplum/data1/mirror/gpseg1
2|chen-es02|7002|/data/greenplum/data2/mirror/gpseg2
3|chen-es02|7003|/data/greenplum/data2/mirror/gpseg3
4|chen-es03|7000|/data/greenplum/data1/mirror/gpseg4
5|chen-es03|7001|/data/greenplum/data1/mirror/gpseg5
6|chen-es03|7002|/data/greenplum/data2/mirror/gpseg6
7|chen-es03|7003|/data/greenplum/data2/mirror/gpseg7
8|chen-es01|7000|/data/greenplum/data1/mirror/gpseg8
9|chen-es01|7001|/data/greenplum/data1/mirror/gpseg9
10|chen-es01|7002|/data/greenplum/data2/mirror/gpseg10
11|chen-es01|7003|/data/greenplum/data2/mirror/gpseg11
確保文件夾存在且爲空
gpssh -f /usr/local/greenplum-db/all_hosts -e 'rm -rf /data/greenplum/data1/mirror/*'
gpssh -f /usr/local/greenplum-db/all_hosts -e 'rm -rf /data/greenplum/data2/mirror/*'
創建mirror
gpaddmirrors -i gpmirrors_config
查看狀態
gpstate -m
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:-Starting gpstate with args: -m
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.8.1 build commit:7118e8aca825b743dd9477d19406fcc06fa53852'
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.8.1 build commit:7118e8aca825b743dd9477d19406fcc06fa53852) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Jun 11 2020 16:37:46'
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:-Obtaining Segment details from master...
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:--------------------------------------------------------------
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:--Current GPDB mirror list and status
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:--Type = Group
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:--------------------------------------------------------------
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- Mirror Datadir Port Status Data Status
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es02 /data/greenplum/data1/mirror/gpseg0 7000 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es02 /data/greenplum/data1/mirror/gpseg1 7001 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es02 /data/greenplum/data2/mirror/gpseg2 7002 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es02 /data/greenplum/data2/mirror/gpseg3 7003 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es03 /data/greenplum/data1/mirror/gpseg4 7000 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es03 /data/greenplum/data1/mirror/gpseg5 7001 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es03 /data/greenplum/data2/mirror/gpseg6 7002 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es03 /data/greenplum/data2/mirror/gpseg7 7003 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es01 /data/greenplum/data1/mirror/gpseg8 7000 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es01 /data/greenplum/data1/mirror/gpseg9 7001 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es01 /data/greenplum/data2/mirror/gpseg10 7002 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:- chen-es01 /data/greenplum/data2/mirror/gpseg11 7003 Passive Synchronized
20200623:15:28:47:023871 gpstate:chen-es01:gpadmin-[INFO]:--------------------------------------------------------------
如果有錯誤可以到 /home/gpadmin/gpAdminLogs 目錄下查看錯誤日誌。