This section explains how to create, set, and register the standby server instance.
See
Refer to "Appendix A Parameters" for details on each parameter.
Refer to "mc_ctl" in Reference for information on the command.
Perform the following procedure:
Set the kernel parameters.
Refer to "Configuring Kernel Parameters" in the Installation and Setup Guide for Server for details.
When using transparent data encryption, configure the encryption settings for the storage data.
Refer to "Protecting Storage Data Using Transparent Data Encryption" or "Using Transparent Data Encryption with Key Management Systems as Keystores" in the Operation Guide for details, and then configure the settings.
Execute the pg_basebackup command to create a copy of the primary server instance on the standby server.
Example)
$ pg_basebackup -D /database/inst1 -X fetch --waldir=/transaction/inst1 --progress --verbose -R --dbname='application_name=standbyServerName' -h primaryServerIpAddress -p primaryServerPortNumber
Note
Use the pg_basebackup command with the -R option to create a standby.signal file. If you do not create the standby.signal file, the Mirroring Controller cannot be started as a standby server.
If using a method that requires password authentication for connections to the primary server, you will need to ensure that authentication is performed automatically. If the -R option is specified for the pg_basebackup command and the password parameter is specified for the --dbname option, the pg_basebackup command will set the password in the primary_conninfo parameter in postgresql.auto.conf file, enabling connections to be performed automatically.
If a password is not set in the primary_conninfo parameter in postgresql.auto.conf file, it will be necessary to create a .pgpass file in the home directory of the instance administrator user, and specify a password for the replication database.
The primary_conninfo parameter should not be set in the postgresql.conf file, but only in the postgresql.auto.conf file using the pg_basebackup command.
When executing the pg_basebackup command, consider the following for collection of transaction logs.
When "fetch" is specified for the -X option of the command
Transaction logs are collected at the end of the backup, so it is necessary to ensure that transaction logs that occur during backup are not deleted from the primary server. Therefore, allow for a sufficient value for the wal_keep_size parameter in postgresql.conf.
When the -X option is omitted or "stream" is specified for the -X option of the command
Transaction logs are streamed, so when Mirroring Controller is running on the primary server, the connection is changed to a synchronous standby server on detection of a streaming replication connection using this command. Therefore, if a job has started on the primary server, the primary server will be impacted, therefore execute this command after stopping only the Mirroring Controller process on the primary server.
See
Refer to "Hot Standby" in the PostgreSQL Documentation for information on the standby.signal file.
Set the parameters shown in the table below in the postgresql.conf file.
Parameter | Content specified | Remarks |
---|---|---|
synchronous_standby_names | 'primaryServerName' | Required after switching the primary server and then changing the original primary server to the new standby server. Enclose the name in single quotation marks ('). Do not change this parameter while Mirroring Controller is running. Do not specify multiple names to this parameter as the Mirroring Controller can manage only one standby server. |