After you activate a standby master for recovery, the standby master becomes the primary master. You can continue running that instance as the primary master if it has the same capabilities and dependability as the original master host.

You must initialize a new standby master to continue providing master mirroring unless you have already done so while activating the prior standby master. Run gpinitstandby on the active master host to configure a new standby master. See Enabling Master Mirroring.

You can restore the primary and standby master instances on the original hosts. This process swaps the roles of the primary and standby master hosts, and it should be performed only if you strongly prefer to run the master instances on the same hosts they occupied prior to the recovery scenario.

Important

Restoring the primary and standby master instances to their original hosts is not an online operation. The master host must be stopped to perform the operation.

For information about the Greenplum Database utilities, see the Greenplum Database Utility Guide.

Parent topic: Recovering a Failed Master

To restore the master mirroring after a recovery

  1. Ensure the original master host is in dependable running condition; ensure the cause of the original failure is fixed.
  2. On the original master host, move or remove the data directory, gpseg-1. This example moves the directory to backup_gpseg-1:

    1. $ mv /data/master/gpseg-1 /data/master/backup_gpseg-1

    You can remove the backup directory once the standby is successfully configured.

  3. Initialize a standby master on the original master host. For example, run this command from the current master host, smdw:

    1. $ gpinitstandby -s mdw
  4. After the initialization completes, check the status of standby master, mdw. Run gpstate with the -f option to check the standby master status:

    1. $ gpstate -f

    The standby master status should be passive, and the WAL sender state should be streaming.

To restore the master and standby instances on original hosts (optional)

Note

Before performing the steps in this section, be sure you have followed the steps to restore master mirroring after a recovery, as described in the To restore the master mirroring after a recoveryprevious section.

  1. Stop the Greenplum Database master instance on the standby master. For example:

    1. $ gpstop -m
  2. Run the gpactivatestandby utility from the original master host, mdw, that is currently a standby master. For example:

    1. $ gpactivatestandby -d $MASTER_DATA_DIRECTORY

    Where the -d option specifies the data directory of the host you are activating.

  3. After the utility completes, run gpstate with the -b option to display a summary of the system status:

    1. $ gpstate -b

    The master instance status should be Active. When a standby master is not configured, the command displays No master standby configured for the standby master state.

  4. On the standby master host, move or remove the data directory, gpseg-1. This example moves the directory:

    1. $ mv /data/master/gpseg-1 /data/master/backup_gpseg-1

    You can remove the backup directory once the standby is successfully configured.

  5. After the original master host runs the primary Greenplum Database master, you can initialize a standby master on the original standby master host. For example:

    1. $ gpinitstandby -s smdw

    After the command completes, you can run the gpstate -f command on the primary master host, to check the standby master status.

To check the status of the master mirroring process (optional)

You can run the gpstate utility with the -f option to display details of the standby master host.

  1. $ gpstate -f

The standby master status should be passive, and the WAL sender state should be streaming.

For information about the gpstate utility, see the Greenplum Database Utility Guide.