gpactivatestandby

gpactivatestandby

Activates a standby master host and makes it the active master for the Greenplum Database system.

Synopsis

gpactivatestandby -d standby_master_datadir [-c new_standby_master] [-f] [-a] [-q] [-l logfile_directory]

gpactivatestandby -? | -h | --help

gpactivatestandby -v

Description

The gpactivatestandby utility activates a backup master host and brings it into operation as the active master instance for a Greenplum Database system. The activated standby master effectively becomes the Greenplum Database master, accepting client connections on the master port (which must be set to the same port number on the master host and the backup master host).

You must run this utility from the master host you are activating, not the failed master host you are disabling. Running this utility assumes you have a backup master host configured for the system (see gpinitstandby).

The utility will perform the following steps:

•Stop the synchronization process (gpsyncagent) on the backup master

•Update the system catalog tables of the backup master using the logs

•Activate the backup master to be the new active master for the system

•(optional) Make the host specified with the -c option the new standby master host

•Restart the Greenplum Database system with the new master host

A backup Greenplum master host serves as a ‘warm standby’ in the event of the primary Greenplum master host becoming unoperational. The backup master is kept up to date by a transaction log replication process (gpsyncagent), which runs on the backup master host and keeps the data between the primary and backup master hosts synchronized.

If the primary master fails, the log replication process is shutdown, and the backup master can be activated in its place by using the gpactivatestandby utility. Upon activation of the backup master, the replicated logs are used to reconstruct the state of the Greenplum master host at the time of the last successfully committed transaction. To specify a new standby master host after making your current standby master active, use the -c option.

In order to use gpactivatestandby to activate a new primary master host, the master host that was previously serving as the primary master cannot be running. The utility checks for a postmaster.pid file in the data directory of the disabled master host, and if it finds it there, it will assume the old master host is still active. In some cases, you may need to remove the postmaster.pid file from the disabled master host data directory before running gpactivatestandby (for example, if the disabled master host process was terminated unexpectedly).

After activating a standby master, run ANALYZE to update the database query statistics. For example:

psql dbname -c 'ANALYZE;'

Options

-a (do not prompt)

Do not prompt the user for confirmation.

-c new_standby_master_hostname

Optional. After you activate your standby master you may want to specify another host to be the new standby, otherwise your Greenplum Database system will no longer have a standby master configured. Use this option to specify the hostname of the new standby master host. You can also use gpinitstandby at a later time to configure a new standby master host.

-d standby_master_datadir

Required. The absolute path of the data directory for the master host you are activating.

-f (force activation)

Use this option to force activation of the backup master host when the synchronization process (gpsyncagent) is not running. Only use this option if you are sure that the backup and primary master hosts are consistent, and you know the gpsyncagent process is not running on the backup master host. This option may be useful if you have just initialized a new backup master using gpinitstandby, and want to activate it immediately.

-l logfile_directory

The directory to write the log file. Defaults to ~/gpAdminLogs.

-q (no screen output)

Run in quiet mode. Command output is not displayed on the screen, but is still written to the log file.

-v (show utility version)

Displays the version, status, last updated date, and check sum of this utility.

-? | -h | --help (help)

Displays the online help.

Examples

Activate the backup master host and make it the active master instance for a Greenplum Database system (run from backup master host you are activating):

gpactivatestandby -d /gpdata

Activate the backup master host and at the same time configure another host to be your new standby master:

gpactivatestandby -d /gpdata -c new_standby_hostname