Greenplum 添加segment mirror节点

简介:
添加mirror也分两种情况,在现有的GP集群节点中添加,或者新加的主机中添加。
如果在新加的主机中添加mirror,那么首先需要做的是对应主机的初始化(包括OS的配置,SSH KEY的交换,GP BIN的安装等等)
对应新加主机的部分,可以参考 Greenplum 扩展 segment个数 中的方法来添加新的主机。这里不多说。
http://yq.aliyun.com/articles/177

接下来的就是可以复用的内容。

在所有需要添加mirror的主机,创建存放mirror的数据目录
$ mkdir /disk1/digoal/gpdata_mirror

产生配置文件
$ gpaddmirrors -o ./addmirror
需要输入每个primary segment对应的mirror的目录
Enter mirror segment data directory location 1 of 23 >
/disk1/digoal/gpdata_mirror
Enter mirror segment data directory location 2 of 23 >
/disk1/digoal/gpdata_mirror
Enter mirror segment data directory location 3 of 23 >
......
Enter mirror segment data directory location 23 of 23 >
/disk1/digoal/gpdata_mirror
20151217:17:58:15:070582 gpaddmirrors:digoal:digoal-[INFO]:-Configuration file output to ./addmirror successfully.

查看配置文件
$ cat addmirror 
filespaceOrder=
mirror0=0:digoal.sqa.zmf:41000:42000:43000:/disk1/digoal/gpdata_mirror/gpseg0
mirror1=1:digoal.sqa.zmf:41001:42001:43001:/disk1/digoal/gpdata_mirror/gpseg1
mirror2=2:digoal.sqa.zmf:41002:42002:43002:/disk1/digoal/gpdata_mirror/gpseg2
mirror3=3:digoal.sqa.zmf:41003:42003:43003:/disk1/digoal/gpdata_mirror/gpseg3
mirror4=4:digoal.sqa.zmf:41004:42004:43004:/disk1/digoal/gpdata_mirror/gpseg4
mirror5=5:digoal.sqa.zmf:41005:42005:43005:/disk1/digoal/gpdata_mirror/gpseg5
mirror6=6:digoal.sqa.zmf:41006:42006:43006:/disk1/digoal/gpdata_mirror/gpseg6
mirror7=7:digoal.sqa.zmf:41007:42007:43007:/disk1/digoal/gpdata_mirror/gpseg7
mirror8=8:digoal.sqa.zmf:41008:42008:43008:/disk1/digoal/gpdata_mirror/gpseg8
mirror9=9:digoal.sqa.zmf:41009:42009:43009:/disk1/digoal/gpdata_mirror/gpseg9
mirror10=10:digoal.sqa.zmf:41010:42010:43010:/disk1/digoal/gpdata_mirror/gpseg10
mirror11=11:digoal.sqa.zmf:41011:42011:43011:/disk1/digoal/gpdata_mirror/gpseg11
mirror12=12:digoal.sqa.zmf:41012:42012:43012:/disk1/digoal/gpdata_mirror/gpseg12
mirror13=13:digoal.sqa.zmf:41013:42013:43013:/disk1/digoal/gpdata_mirror/gpseg13
mirror14=14:digoal.sqa.zmf:41014:42014:43014:/disk1/digoal/gpdata_mirror/gpseg14
mirror15=15:digoal.sqa.zmf:41015:42015:43015:/disk1/digoal/gpdata_mirror/gpseg15
mirror16=16:digoal.sqa.zmf:41016:42016:43016:/disk1/digoal/gpdata_mirror/gpseg16
mirror17=17:digoal.sqa.zmf:41017:42017:43017:/disk1/digoal/gpdata_mirror/gpseg17
mirror18=18:digoal.sqa.zmf:41018:42018:43018:/disk1/digoal/gpdata_mirror/gpseg18
mirror19=19:digoal.sqa.zmf:41019:42019:43019:/disk1/digoal/gpdata_mirror/gpseg19
mirror20=20:digoal.sqa.zmf:41020:42020:43020:/disk1/digoal/gpdata_mirror/gpseg20
mirror21=21:digoal.sqa.zmf:41021:42021:43021:/disk1/digoal/gpdata_mirror/gpseg21
mirror22=22:digoal.sqa.zmf:41022:42022:43022:/disk1/digoal/gpdata_mirror/gpseg22

如果你不满意,可以自行修改以上配置文件。
解释一下配置文件的含义。可以查看 gp_segment_configuration,  pg_filespace, pg_filespace_entry 获得内容。
postgres=# select * from gp_segment_configuration order by role,content;
    1 |      -1 | p    | p              | s    | u      |  1921 | digoal.sqa.zmf | digoal.sqa.zmf |                  | 
    2 |       0 | p    | p              | s    | u      | 40000 | digoal.sqa.zmf | digoal.sqa.zmf |            43000 | 
    3 |       1 | p    | p              | s    | u      | 40001 | digoal.sqa.zmf | digoal.sqa.zmf |            43001 | 
    4 |       2 | p    | p              | s    | u      | 40002 | digoal.sqa.zmf | digoal.sqa.zmf |            43002 | 
    5 |       3 | p    | p              | s    | u      | 40003 | digoal.sqa.zmf | digoal.sqa.zmf |            43003 | 
    6 |       4 | p    | p              | s    | u      | 40004 | digoal.sqa.zmf | digoal.sqa.zmf |            43004 | 
    7 |       5 | p    | p              | s    | u      | 40005 | digoal.sqa.zmf | digoal.sqa.zmf |            43005 | 
    8 |       6 | p    | p              | s    | u      | 40006 | digoal.sqa.zmf | digoal.sqa.zmf |            43006 | 
    9 |       7 | p    | p              | s    | u      | 40007 | digoal.sqa.zmf | digoal.sqa.zmf |            43007 | 
   10 |       8 | p    | p              | s    | u      | 40008 | digoal.sqa.zmf | digoal.sqa.zmf |            43008 | 
   11 |       9 | p    | p              | s    | u      | 40009 | digoal.sqa.zmf | digoal.sqa.zmf |            43009 | 
   12 |      10 | p    | p              | s    | u      | 40010 | digoal.sqa.zmf | digoal.sqa.zmf |            43010 | 
   13 |      11 | p    | p              | s    | u      | 40011 | digoal.sqa.zmf | digoal.sqa.zmf |            43011 | 
   14 |      12 | p    | p              | s    | u      | 40012 | digoal.sqa.zmf | digoal.sqa.zmf |            43012 | 
   15 |      13 | p    | p              | s    | u      | 40013 | digoal.sqa.zmf | digoal.sqa.zmf |            43013 | 
   16 |      14 | p    | p              | s    | u      | 40014 | digoal.sqa.zmf | digoal.sqa.zmf |            43014 | 
   17 |      15 | p    | p              | s    | u      | 40015 | digoal.sqa.zmf | digoal.sqa.zmf |            43015 | 
   18 |      16 | p    | p              | s    | u      | 40016 | digoal.sqa.zmf | digoal.sqa.zmf |            43016 | 
   19 |      17 | p    | p              | s    | u      | 40017 | digoal.sqa.zmf | digoal.sqa.zmf |            43017 | 
   20 |      18 | p    | p              | s    | u      | 40018 | digoal.sqa.zmf | digoal.sqa.zmf |            43018 | 
   21 |      19 | p    | p              | s    | u      | 40019 | digoal.sqa.zmf | digoal.sqa.zmf |            43019 | 
   22 |      20 | p    | p              | s    | u      | 40020 | digoal.sqa.zmf | digoal.sqa.zmf |            43020 | 
   23 |      21 | p    | p              | s    | u      | 40021 | digoal.sqa.zmf | digoal.sqa.zmf |            43021 | 
   24 |      22 | p    | p              | s    | u      | 50011 | digoal.sqa.zmf | digoal.sqa.zmf |            43022 | 

postgres=# select * from pg_filespace;
  fsname   | fsowner 
-----------+---------
 pg_system |      10
(1 row)

postgres=# select * from pg_filespace_entry ;
 fsefsoid | fsedbid |              fselocation              
----------+---------+---------------------------------------
     3052 |       1 | /disk1/digoal/gpdata/gpseg-1
     3052 |       2 | /disk1/digoal/gpdata/gpseg0
     3052 |       3 | /disk1/digoal/gpdata/gpseg1
     3052 |       4 | /disk1/digoal/gpdata/gpseg2
     3052 |       5 | /disk1/digoal/gpdata/gpseg3
     3052 |       6 | /disk1/digoal/gpdata/gpseg4
     3052 |       7 | /disk1/digoal/gpdata/gpseg5
     3052 |       8 | /disk1/digoal/gpdata/gpseg6
     3052 |       9 | /disk1/digoal/gpdata/gpseg7
     3052 |      10 | /disk1/digoal/gpdata/gpseg8
     3052 |      11 | /disk1/digoal/gpdata/gpseg9
     3052 |      12 | /disk1/digoal/gpdata/gpseg10
     3052 |      13 | /disk1/digoal/gpdata/gpseg11
     3052 |      14 | /disk1/digoal/gpdata/gpseg12
     3052 |      15 | /disk1/digoal/gpdata/gpseg13
     3052 |      16 | /disk1/digoal/gpdata/gpseg14
     3052 |      17 | /disk1/digoal/gpdata/gpseg15
     3052 |      18 | /disk1/digoal/gpdata/gpseg16
     3052 |      19 | /disk1/digoal/gpdata/gpseg17
     3052 |      20 | /disk1/digoal/gpdata/gpseg18
     3052 |      21 | /disk1/digoal/gpdata/gpseg19
     3052 |      22 | /disk1/digoal/gpdata/gpseg20
     3052 |      23 | /disk1/digoal/gpdata/gpseg21
     3052 |      24 | /disk1/digoal/gpdata/gpseg22
     3052 |      25 | /disk1/digoal/gpdata_mirror/gpseg0
     3052 |      26 | /disk1/digoal/gpdata_mirror/gpseg1
     3052 |      27 | /disk1/digoal/gpdata_mirror/gpseg2
     3052 |      28 | /disk1/digoal/gpdata_mirror/gpseg3
     3052 |      29 | /disk1/digoal/gpdata_mirror/gpseg4
     3052 |      30 | /disk1/digoal/gpdata_mirror/gpseg5
     3052 |      31 | /disk1/digoal/gpdata_mirror/gpseg6
     3052 |      32 | /disk1/digoal/gpdata_mirror/gpseg7
     3052 |      33 | /disk1/digoal/gpdata_mirror/gpseg8
     3052 |      34 | /disk1/digoal/gpdata_mirror/gpseg9
     3052 |      35 | /disk1/digoal/gpdata_mirror/gpseg10
     3052 |      36 | /disk1/digoal/gpdata_mirror/gpseg11
     3052 |      37 | /disk1/digoal/gpdata_mirror/gpseg12
     3052 |      38 | /disk1/digoal/gpdata_mirror/gpseg13
     3052 |      39 | /disk1/digoal/gpdata_mirror/gpseg14
     3052 |      40 | /disk1/digoal/gpdata_mirror/gpseg15
     3052 |      41 | /disk1/digoal/gpdata_mirror/gpseg16
     3052 |      42 | /disk1/digoal/gpdata_mirror/gpseg17
     3052 |      43 | /disk1/digoal/gpdata_mirror/gpseg18
     3052 |      44 | /disk1/digoal/gpdata_mirror/gpseg19
     3052 |      45 | /disk1/digoal/gpdata_mirror/gpseg20
     3052 |      46 | /disk1/digoal/gpdata_mirror/gpseg21
     3052 |      47 | /disk1/digoal/gpdata_mirror/gpseg22
(47 rows)

配置文件格式:
-i <mirror_config_file>

 A configuration file containing one line for each mirror segment 
 you want to create. You must have one mirror segment listed for 
 each primary segment in the system. The format of this file is as 
 follows (as per attributes in the gp_segment_configuration, 
 pg_filespace, and pg_filespace_entry catalog tables):

   filespaceOrder=[<filespace1_fsname>[:<filespace2_fsname>:...]
   mirror<content>=<content>:<address>:<port>:<mir_replication_port>:<pri_replication_port>:<fselocation>[:<fselocation>:...]

 Note that you only need to specify a name for filespaceOrder if 
 your system has multiple filespaces configured. If your system does 
 not have additional filespaces configured besides the default pg_system 
 filespace, this file will only have one location per segment (for 
 the default data directory filespace, pg_system). pg_system does 
 not need to be listed in the filespaceOrder line. It will always be 
 the first <fselocation> listed after <replication_port>.
根据这个格式,以及系统信息,可以定制那个mirror跑在哪台主机上,以及目录信息都可以配置。

正式添加mirror
gpaddmirrors -i ./addmirror -v -B 1

20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=content id                     delimiter='=' value=None
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=contentId                      delimiter=':' value=0
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=address                        delimiter=':' value=digoal.sqa.zmf
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=port                           delimiter=':' value=41000
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=replicationPort                delimiter=':' value=42000
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=primarySegmentReplicationPort  delimiter=':' value=43000
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=dataDirectory                  delimiter=':' value=/disk1/digoal/gpdata_mirror/gpseg0
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-./addmirror:3
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=content id                     delimiter='=' value=None
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=contentId                      delimiter=':' value=1
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=address                        delimiter=':' value=digoal.sqa.zmf
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=port                           delimiter=':' value=41001
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=replicationPort                delimiter=':' value=42001
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=primarySegmentReplicationPort  delimiter=':' value=43001
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-  name=dataDirectory                  delimiter=':' value=/disk1/digoal/gpdata_mirror/gpseg1
......
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-Greenplum Add Mirrors Parameters
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:----------------------------------------------------------
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-Greenplum master data directory          = /disk1/digoal/gpdata/gpseg-1
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-Greenplum master port                    = 1921
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-Parallel batch limit                     = 1
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:----------------------------------------------------------
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-Mirror 1 of 23
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:----------------------------------------------------------
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Primary instance host               = digoal.sqa.zmf
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Primary instance address            = digoal.sqa.zmf
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Primary instance directory          = /disk1/digoal/gpdata/gpseg0
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Primary instance port               = 40000
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Primary instance replication port   = 43000
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Mirror instance host                = digoal.sqa.zmf
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Mirror instance address             = digoal.sqa.zmf
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Mirror instance directory           = /disk1/digoal/gpdata_mirror/gpseg0
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Mirror instance port                = 41000
20151217:17:59:13:071643 gpaddmirrors:digoal:digoal-[INFO]:-   Mirror instance replication port    = 42000
......
Continue with add mirrors procedure Yy|Nn (default=N):
> y
......
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[INFO]:-Process results...
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[INFO]:-Done updating primaries
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[INFO]:-******************************************************************
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[INFO]:-Mirror segments have been added; data synchronization is in progress.
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[INFO]:-Data synchronization will continue in the background.
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[INFO]:-
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[INFO]:-Use  gpstate -s  to check the resynchronization progress.
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[INFO]:-******************************************************************
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-WorkerPool haltWork()
20151217:17:59:36:071643 gpaddmirrors:digoal:digoal-[DEBUG]:-[worker0] haltWork

查看mirror同步状态
$ gpstate -s
Resynchronizing表示还在同步
Synchronized表示同步完成。
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-   Segment Info
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Hostname                                = digoal.sqa.zmf
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Address                                 = digoal.sqa.zmf
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Datadir                                 = /disk1/digoal/gpdata/gpseg0
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Port                                    = 40000
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-   Mirroring Info
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Current role                            = Primary
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Preferred role                          = Primary
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Mirror status                           = Resynchronizing
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-   Change Tracking Info
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Change tracking data size               = 8.25 MB
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-   Resynchronization Info
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Resynchronization mode                  = Full
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Data synchronized                       = 119 MB
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Estimated total data to synchronize     = 121 MB
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Estimated resync progress with mirror   = 98.91%
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Total resync objects                    = 1030
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Objects to resync                       = 0
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Estimated resync end time               = 2015-12-17 17:59:53
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-   Status
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      PID                                     = 68982
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Configuration reports status as         = Up
20151217:17:59:58:074049 gpstate:digoal:digoal-[INFO]:-      Database status                         = Suspended

或者
gpstate  -m
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-Starting gpstate with args: -m
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.6.1 build 2'
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.6.1 build 2) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Oct  1 2015 15:14:22'
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-Obtaining Segment details from master...
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:--------------------------------------------------------------
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:--Current GPDB mirror list and status
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:--Type = Group
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:--------------------------------------------------------------
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   Mirror              Datadir                                 Port    Status    Data Status    
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg0    41000   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg1    41001   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg2    41002   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg3    41003   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg4    41004   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg5    41005   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg6    41006   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg7    41007   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg8    41008   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg9    41009   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg10   41010   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg11   41011   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg12   41012   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg13   41013   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg14   41014   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg15   41015   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg16   41016   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg17   41017   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg18   41018   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg19   41019   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg20   41020   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg21   41021   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:-   digoal.sqa.zmf   /disk1/digoal/gpdata_mirror/gpseg22   41022   Passive   Synchronized
20151217:19:37:04:124869 gpstate:digoal:digoal-[INFO]:--------------------------------------------------------------

addmirror时,输出的端口信息解释
-  name=port                           delimiter=':' value=41013  对应mirror的postmaster监听端口
-  name=replicationPort                delimiter=':' value=42013  对应mirror的receiver ack process监听端口
-  name=primarySegmentReplicationPort  delimiter=':' value=43013  对应primary的receiver process监听端口
也对应了使用gpinitsystem初始化数据库时指定的几个配置。
MIRROR_PORT_BASE
 Optional. This specifies the base number by which mirror segment 
 port numbers are calculated. The first mirror segment port on a 
 host is set as MIRROR_PORT_BASE, and then incremented by one 
 for each additional mirror segment on that host. Valid values 
 range from 1 through 65535 and cannot conflict with the ports 
 calculated by PORT_BASE.


REPLICATION_PORT_BASE
 Optional. This specifies the base number by which the port numbers 
 for the primary file replication process are calculated. The 
 first replication port on a host is set as REPLICATION_PORT_BASE, 
 and then incremented by one for each additional primary segment 
 on that host. Valid values range from 1 through 65535 and cannot 
 conflict with the ports calculated by PORT_BASE or MIRROR_PORT_BASE.


MIRROR_REPLICATION_PORT_BASE
 Optional. This specifies the base number by which the port numbers 
 for the mirror file replication process are calculated. The first 
 mirror replication port on a host is set as MIRROR_REPLICATION_PORT_BASE, 
 and then incremented by one for each additional mirror segment on 
 that host. Valid values range from 1 through 65535 and cannot conflict 
 with the ports calculated by PORT_BASE, MIRROR_PORT_BASE, 
 or REPLICATION_PORT_BASE.

primary
digoal  73315  68987  0 17:59 ?        00:00:00 postgres: port 40013, primary process                                                                                                            
digoal  73376  73315  0 17:59 ?        00:00:00 postgres: port 40013, primary receiver ack process                                                                                               
digoal  73381  73315  0 17:59 ?        00:00:05 postgres: port 40013, primary sender process                                                                                                     
digoal  73387  73315  0 17:59 ?        00:00:00 postgres: port 40013, primary consumer ack process                                                                                               
digoal  73393  73315  0 17:59 ?        00:00:03 postgres: port 40013, primary recovery process                                                                                                   
digoal  73400  73315  0 17:59 ?        00:00:00 postgres: port 40013, primary verification process

mirror
digoal  72906  72703  0 17:59 ?        00:00:00 postgres: port 41013, mirror process                                                                                                                   
digoal  72932  72906  0 17:59 ?        00:00:10 postgres: port 41013, mirror receiver process                                                                                                          
digoal  72934  72906  0 17:59 ?        00:00:14 postgres: port 41013, mirror consumer process                                                                                                          
digoal  72936  72906  0 17:59 ?        00:00:01 postgres: port 41013, mirror consumer writer process                                                                                                   
digoal  72938  72906  0 17:59 ?        00:00:00 postgres: port 41013, mirror consumer append only process                                                                                              
digoal  72939  72906  0 17:59 ?        00:00:00 postgres: port 41013, mirror sender ack process                                                                                                        
digoal  72940  72906  0 17:59 ?        00:00:00 postgres: port 41013, mirror verification process

连接是这样的。
primary sender -> mirror receiver
mirror sender ack -> primary receiver ack

查看segment的元数据信息。
postgres=# select * from gp_segment_configuration order by dbid;
 dbid | content | role | preferred_role | mode | status | port  |     hostname      |      address      | replication_port | san_mounts 
------+---------+------+----------------+------+--------+-------+-------------------+-------------------+------------------+------------
    1 |      -1 | p    | p              | s    | u      |  1921 | digoal.sqa.zmf | digoal.sqa.zmf |                  | 
    2 |       0 | p    | p              | s    | u      | 40000 | digoal.sqa.zmf | digoal.sqa.zmf |            43000 | 
    3 |       1 | p    | p              | s    | u      | 40001 | digoal.sqa.zmf | digoal.sqa.zmf |            43001 | 
    4 |       2 | p    | p              | s    | u      | 40002 | digoal.sqa.zmf | digoal.sqa.zmf |            43002 | 
    5 |       3 | p    | p              | s    | u      | 40003 | digoal.sqa.zmf | digoal.sqa.zmf |            43003 | 
    6 |       4 | p    | p              | s    | u      | 40004 | digoal.sqa.zmf | digoal.sqa.zmf |            43004 | 
    7 |       5 | p    | p              | s    | u      | 40005 | digoal.sqa.zmf | digoal.sqa.zmf |            43005 | 
    8 |       6 | p    | p              | s    | u      | 40006 | digoal.sqa.zmf | digoal.sqa.zmf |            43006 | 
    9 |       7 | p    | p              | s    | u      | 40007 | digoal.sqa.zmf | digoal.sqa.zmf |            43007 | 
   10 |       8 | p    | p              | s    | u      | 40008 | digoal.sqa.zmf | digoal.sqa.zmf |            43008 | 
   11 |       9 | p    | p              | s    | u      | 40009 | digoal.sqa.zmf | digoal.sqa.zmf |            43009 | 
   12 |      10 | p    | p              | s    | u      | 40010 | digoal.sqa.zmf | digoal.sqa.zmf |            43010 | 
   13 |      11 | p    | p              | s    | u      | 40011 | digoal.sqa.zmf | digoal.sqa.zmf |            43011 | 
   14 |      12 | p    | p              | s    | u      | 40012 | digoal.sqa.zmf | digoal.sqa.zmf |            43012 | 
   15 |      13 | p    | p              | s    | u      | 40013 | digoal.sqa.zmf | digoal.sqa.zmf |            43013 | 
   16 |      14 | p    | p              | s    | u      | 40014 | digoal.sqa.zmf | digoal.sqa.zmf |            43014 | 
   17 |      15 | p    | p              | s    | u      | 40015 | digoal.sqa.zmf | digoal.sqa.zmf |            43015 | 
   18 |      16 | p    | p              | s    | u      | 40016 | digoal.sqa.zmf | digoal.sqa.zmf |            43016 | 
   19 |      17 | p    | p              | s    | u      | 40017 | digoal.sqa.zmf | digoal.sqa.zmf |            43017 | 
   20 |      18 | p    | p              | s    | u      | 40018 | digoal.sqa.zmf | digoal.sqa.zmf |            43018 | 
   21 |      19 | p    | p              | s    | u      | 40019 | digoal.sqa.zmf | digoal.sqa.zmf |            43019 | 
   22 |      20 | p    | p              | s    | u      | 40020 | digoal.sqa.zmf | digoal.sqa.zmf |            43020 | 
   23 |      21 | p    | p              | s    | u      | 40021 | digoal.sqa.zmf | digoal.sqa.zmf |            43021 | 
   24 |      22 | p    | p              | s    | u      | 50011 | digoal.sqa.zmf | digoal.sqa.zmf |            43022 | 
   25 |       0 | m    | m              | s    | u      | 41000 | digoal.sqa.zmf | digoal.sqa.zmf |            42000 | 
   26 |       1 | m    | m              | s    | u      | 41001 | digoal.sqa.zmf | digoal.sqa.zmf |            42001 | 
   27 |       2 | m    | m              | s    | u      | 41002 | digoal.sqa.zmf | digoal.sqa.zmf |            42002 | 
   28 |       3 | m    | m              | s    | u      | 41003 | digoal.sqa.zmf | digoal.sqa.zmf |            42003 | 
   29 |       4 | m    | m              | s    | u      | 41004 | digoal.sqa.zmf | digoal.sqa.zmf |            42004 | 
   30 |       5 | m    | m              | s    | u      | 41005 | digoal.sqa.zmf | digoal.sqa.zmf |            42005 | 
   31 |       6 | m    | m              | s    | u      | 41006 | digoal.sqa.zmf | digoal.sqa.zmf |            42006 | 
   32 |       7 | m    | m              | s    | u      | 41007 | digoal.sqa.zmf | digoal.sqa.zmf |            42007 | 
   33 |       8 | m    | m              | s    | u      | 41008 | digoal.sqa.zmf | digoal.sqa.zmf |            42008 | 
   34 |       9 | m    | m              | s    | u      | 41009 | digoal.sqa.zmf | digoal.sqa.zmf |            42009 | 
   35 |      10 | m    | m              | s    | u      | 41010 | digoal.sqa.zmf | digoal.sqa.zmf |            42010 | 
   36 |      11 | m    | m              | s    | u      | 41011 | digoal.sqa.zmf | digoal.sqa.zmf |            42011 | 
   37 |      12 | m    | m              | s    | u      | 41012 | digoal.sqa.zmf | digoal.sqa.zmf |            42012 | 
   38 |      13 | m    | m              | s    | u      | 41013 | digoal.sqa.zmf | digoal.sqa.zmf |            42013 | 
   39 |      14 | m    | m              | s    | u      | 41014 | digoal.sqa.zmf | digoal.sqa.zmf |            42014 | 
   40 |      15 | m    | m              | s    | u      | 41015 | digoal.sqa.zmf | digoal.sqa.zmf |            42015 | 
   41 |      16 | m    | m              | s    | u      | 41016 | digoal.sqa.zmf | digoal.sqa.zmf |            42016 | 
   42 |      17 | m    | m              | s    | u      | 41017 | digoal.sqa.zmf | digoal.sqa.zmf |            42017 | 
   43 |      18 | m    | m              | s    | u      | 41018 | digoal.sqa.zmf | digoal.sqa.zmf |            42018 | 
   44 |      19 | m    | m              | s    | u      | 41019 | digoal.sqa.zmf | digoal.sqa.zmf |            42019 | 
   45 |      20 | m    | m              | s    | u      | 41020 | digoal.sqa.zmf | digoal.sqa.zmf |            42020 | 
   46 |      21 | m    | m              | s    | u      | 41021 | digoal.sqa.zmf | digoal.sqa.zmf |            42021 | 
   47 |      22 | m    | m              | s    | u      | 41022 | digoal.sqa.zmf | digoal.sqa.zmf |            42022 | 
(47 rows)
目录
相关文章
|
存储 固态存储 Ubuntu
postgresql email列表对NVM WAL BUFFER的讨论
postgresql email列表对NVM WAL BUFFER的讨论
64 0
|
运维 容灾 关系型数据库
【DB吐槽大会】第79期 - PG standby不支持配置多个上游节点
大家好,这里是DB吐槽大会,第79期 - PG standby不支持配置多个上游节点
|
存储 算法 NoSQL
【DB吐槽大会】第19期 - PG 没有block level压缩
大家好,这里是DB吐槽大会,第19期 - PG 没有block level压缩
|
搜索推荐 关系型数据库 分布式数据库
【DB吐槽大会】第7期 - PG slot 无failover
大家好,这里是DB吐槽大会,第7期 - PG slot 无failover
|
SQL 网络安全 调度
|
关系型数据库
|
关系型数据库 PostgreSQL SQL
|
关系型数据库 数据库 C语言
Greenplum添加mirror步骤
为只有primary的greenplum添加mirror节点
2559 0