Greenplum adds mirror steps

Keywords: Database GreenPlum PostgreSQL Linux

[TOC]

Summary

The newly installed green plus cluster has only primary nodes and no mirror. High availability is not guaranteed. So you need to add mirror nodes to the cluster

Note: When the amount of data is too large, adding mirror will result in greater disk pressure, because the background will always synchronize the data, which online system needs to pay attention to.

Pre-addition situation

Initialization is only primary

20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-Greenplum Primary Segment Configuration
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:----------------------------------------
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-gw_sdw1     /data/primary/gpseg0     40000     2     0
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-gw_sdw1     /data/primary/gpseg1     40001     3     1
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-gw_sdw1     /data/primary/gpseg2     40002     4     2
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-gw_sdw1     /data/primary/gpseg3     40003     5     3
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-gw_sdw2     /data/primary/gpseg4     40000     6     4
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-gw_sdw2     /data/primary/gpseg5     40001     7     5
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-gw_sdw2     /data/primary/gpseg6     40002     8     6
20190326:00:48:33:005423 gpinitsystem:gw_mdw1:gpadmin-[INFO]:-gw_sdw2     /data/primary/gpseg7     40003     9     7
Continue with Greenplum creation Yy/Nn>

Looking at the system configuration table, we found that only primary nodes were present.

postgres=# SELECT * from gp_segment_configuration ;
 dbid | content | role | preferred_role | mode | status | port  | hostname | address | replication_port | san_mounts 
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 |      -1 | p    | p              | s    | u      |  5432 | gw_mdw1  | gw_mdw1 |                  | 
    2 |       0 | p    | p              | s    | u      | 40000 | gw_sdw1  | gw_sdw1 |                  | 
    6 |       4 | p    | p              | s    | u      | 40000 | gw_sdw2  | gw_sdw2 |                  | 
    3 |       1 | p    | p              | s    | u      | 40001 | gw_sdw1  | gw_sdw1 |                  | 
    7 |       5 | p    | p              | s    | u      | 40001 | gw_sdw2  | gw_sdw2 |                  | 
    4 |       2 | p    | p              | s    | u      | 40002 | gw_sdw1  | gw_sdw1 |                  | 
    8 |       6 | p    | p              | s    | u      | 40002 | gw_sdw2  | gw_sdw2 |                  | 
    5 |       3 | p    | p              | s    | u      | 40003 | gw_sdw1  | gw_sdw1 |                  | 
    9 |       7 | p    | p              | s    | u      | 40003 | gw_sdw2  | gw_sdw2 |                  | 
(9 rows)

Adding steps

Create a data directory for mirrors on all hosts that need to add mirrors

You can use the gpssh command

gpssh -f seg_hosts -e 'mkdir -p /data/mirror'

Generate addmirror file

Execute the gpaddmirrors command, type in the log of the mirror node, and generate the configuration file

[gpadmin@gw_mdw1 ~]$ gpaddmirrors -o ./addmirror
20190326:00:56:21:030831 gpaddmirrors:gw_mdw1:gpadmin-[INFO]:-Starting gpaddmirrors with args: -o ./addmirror
20190326:00:56:21:030831 gpaddmirrors:gw_mdw1:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.1.0 build 6'
20190326:00:56:21:030831 gpaddmirrors:gw_mdw1:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.1.0 build 6) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Jun 11 2014 17:23:40'
20190326:00:56:21:030831 gpaddmirrors:gw_mdw1:gpadmin-[INFO]:-Obtaining Segment details from master...
Enter mirror segment data directory location 1 of 4 >
/data/mirror
Enter mirror segment data directory location 2 of 4 >
/data/mirror
Enter mirror segment data directory location 3 of 4 >
/data/mirror
Enter mirror segment data directory location 4 of 4 >
/data/mirror
20190326:00:57:15:030831 gpaddmirrors:gw_mdw1:gpadmin-[INFO]:-Configuration file output to ./addmirror successfully.

View the file as follows

[gpadmin@gw_mdw1 ~]$ cat addmirror 
filespaceOrder=
mirror0=0:gw_sdw2:41000:42000:43000:/data/mirror/gpseg0
mirror1=1:gw_sdw2:41001:42001:43001:/data/mirror/gpseg1
mirror2=2:gw_sdw2:41002:42002:43002:/data/mirror/gpseg2
mirror3=3:gw_sdw2:41003:42003:43003:/data/mirror/gpseg3
mirror4=4:gw_sdw1:41000:42000:43000:/data/mirror/gpseg4
mirror5=5:gw_sdw1:41001:42001:43001:/data/mirror/gpseg5
mirror6=6:gw_sdw1:41002:42002:43002:/data/mirror/gpseg6
mirror7=7:gw_sdw1:41003:42003:43003:/data/mirror/gpseg7

Execute add commands

[gpadmin@gw_mdw1 ~]$ gpaddmirrors -i addmirror 
20190326:01:08:45:031106 gpaddmirrors:gw_mdw1:gpadmin-[INFO]:-Starting gpaddmirrors with args: -i addmirror
20190326:01:08:45:031106 gpaddmirrors:gw_mdw1:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.1.0 build 6'
20190326:01:08:45:031106 gpaddmirrors:gw_mdw1:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.1.0 build 6) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Jun 11 2014 17:23:40'

The command does not report errors and looks at mirror nodes

Using gpstate-m, we found that all mirror s were synchronizing the data, because my cluster was newly built and the synchronization was completed quickly. At this time, when we execute gpstate-m, we can see that the status of Data Status es is Synchronized.

[gpadmin@gw_mdw1 ~]$ gpstate -m
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-Starting gpstate with args: -m
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.1.0 build 6'
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.1.0 build 6) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Jun 11 2014 17:23:40'
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-Obtaining Segment details from master...
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:--------------------------------------------------------------
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:--Current GPDB mirror list and status
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:--Type = Group
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:--------------------------------------------------------------
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   Mirror    Datadir               Port    Status    Data Status       
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   gw_sdw2   /data/mirror/gpseg0   41000   Passive   Resynchronizing
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   gw_sdw2   /data/mirror/gpseg1   41001   Passive   Resynchronizing
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   gw_sdw2   /data/mirror/gpseg2   41002   Passive   Resynchronizing
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   gw_sdw2   /data/mirror/gpseg3   41003   Passive   Resynchronizing
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   gw_sdw1   /data/mirror/gpseg4   41000   Passive   Resynchronizing
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   gw_sdw1   /data/mirror/gpseg5   41001   Passive   Resynchronizing
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   gw_sdw1   /data/mirror/gpseg6   41002   Passive   Resynchronizing
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:-   gw_sdw1   /data/mirror/gpseg7   41003   Passive   Resynchronizing
20190326:01:09:51:031359 gpstate:gw_mdw1:gpadmin-[INFO]:--------------------------------------------------------------

View node status

Find that all mirror s have been started

postgres=# SELECT * from gp_segment_configuration ;
 dbid | content | role | preferred_role | mode | status | port  | hostname | address | replication_port | san_mounts 
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 |      -1 | p    | p              | s    | u      |  5432 | gw_mdw1  | gw_mdw1 |                  | 
    2 |       0 | p    | p              | s    | u      | 40000 | gw_sdw1  | gw_sdw1 |            43000 | 
   10 |       0 | m    | m              | s    | u      | 41000 | gw_sdw2  | gw_sdw2 |            42000 | 
    3 |       1 | p    | p              | s    | u      | 40001 | gw_sdw1  | gw_sdw1 |            43001 | 
   11 |       1 | m    | m              | s    | u      | 41001 | gw_sdw2  | gw_sdw2 |            42001 | 
    4 |       2 | p    | p              | s    | u      | 40002 | gw_sdw1  | gw_sdw1 |            43002 | 
   12 |       2 | m    | m              | s    | u      | 41002 | gw_sdw2  | gw_sdw2 |            42002 | 
    5 |       3 | p    | p              | s    | u      | 40003 | gw_sdw1  | gw_sdw1 |            43003 | 
   13 |       3 | m    | m              | s    | u      | 41003 | gw_sdw2  | gw_sdw2 |            42003 | 
    6 |       4 | p    | p              | s    | u      | 40000 | gw_sdw2  | gw_sdw2 |            43000 | 
   14 |       4 | m    | m              | s    | u      | 41000 | gw_sdw1  | gw_sdw1 |            42000 | 
    7 |       5 | p    | p              | s    | u      | 40001 | gw_sdw2  | gw_sdw2 |            43001 | 
   15 |       5 | m    | m              | s    | u      | 41001 | gw_sdw1  | gw_sdw1 |            42001 | 
    8 |       6 | p    | p              | s    | u      | 40002 | gw_sdw2  | gw_sdw2 |            43002 | 
   16 |       6 | m    | m              | s    | u      | 41002 | gw_sdw1  | gw_sdw1 |            42002 | 
    9 |       7 | p    | p              | s    | u      | 40003 | gw_sdw2  | gw_sdw2 |            43003 | 
   17 |       7 | m    | m              | s    | u      | 41003 | gw_sdw1  | gw_sdw1 |            42003 | 
(17 rows)

Posted by jumpenjuhosaphat on Sat, 30 Mar 2019 09:18:28 -0700