In database multiplexing mode, rolling updates, that perform the maintenance for the servers that comprise the cluster system, can be performed while jobs continue.
First, perform the maintenance for the standby server, and then switch the standby server to the primary server. Then, perform the maintenance for the original primary server that was switched to the standby server. This enables maintenance to be performed while jobs continue.
See
If the downtime due to the maintenance of the standby server is expected to be long, refer to "Standby server downtime" in "7.7.1 Changes Required when the Standby Server is Stopped".
The flow of a rolling update is shown below.
Figure 7.1 Performing a Rolling Update
Standby server maintenance tasks
To perform the maintenance on the standby server, stop Mirroring Controller.
If you have set automatic start and stop beforehand and you want to turn the server off for maintenance, the server will stop automatically when the operating system is shut down. Accordingly, this step is not necessary.
Example)
$ mc_ctl stop -M /mcdir/inst1
Ensure that Mirroring Controller has completely stopped.
If the multiplexed instances and Mirroring Controller have been configured on the standby server to start and stop automatically when the operating system of the database server is started or stopped, cancel the setting to start and stop automatically.
See
Refer to "6.10 Setting Automatic Start and Stop of Mirroring Controller and Multiplexed Instances" for information on how to configure the multiplexed instances and Mirroring Controller to start and stop automatically when the operating system of the database server start and stops.
As the OS superuser, execute the chkconfig command to disable automatic start and stop.
In the example below, the shell script for automatic start and stop was created as "rc_mc_inst1" and is disabled for run levels 3 and 5.
Example)
# chkconfig --level 35 rc_mc_inst1 off
As the OS superuser, execute the systemctl command to disable automatic start and stop.
The example below disables automatic start and stop of "mcoi_inst1.service".
Example)
# systemctl disable mcoi_inst1.service
Perform maintenance tasks.
Create a copy of the primary server instance on the standby server.
Execute the mc_ctl command in setup mode to create data in the standby server by synchronizing with the primary server.
Example)
$ mc_ctl setup -M /mcdir/inst1 -r standby -U userName -h primaryServerHostName -p primaryServerPortNumber --standby-name=standbyServerName
See
The procedure for copying the primary server instance to the standby server is the same as the procedure for setting up the standby server.
Refer to "6.4.1 Setting up Database Multiplexing Mode on the Standby Server", and then perform the recovery.
Check the settings for automatic start and stop of the multiplexed instances and Mirroring Controller.
If the multiplexed instances and Mirroring Controller were configured in step 2 to not start and stop automatically when the operating system of the database server starts and stops, then change the settings back. This step can be skipped if automatic start and stop are not required.
As the OS superuser, execute the chkconfig command to enable the shell script.
In the example below, the shell script for automatic start and stop was created as "rc_mc_inst1" and is enabled for run levels 3 and 5.
Example)
# chkconfig --level 35 rc_mc_inst1 on
As the OS superuser, execute the systemctl command to enable automatic start and stop.
The example below disables automatic start and stop of "mcoi_inst1.service".
Example)
# systemctl enable mcoi_inst1.service
Start (rebuild) Mirroring Controller on the standby server.
This operation is required when determining the maintenance tasks on the standby server.
As the instance administrator user, execute the mc_ctl command in start mode with the -f option specified. This enables automatic switch and disconnection.
If you start Mirroring Controller and the instance without specifying the -f option, automatic switch and disconnection will not be enabled. To enable both, start Mirroring Controller and then execute the mc_ctl command in enable-failover mode, or restart Mirroring Controller with the -f option specified.
Example)
$ mc_ctl start -M /mcdir/inst1 -f
As the instance administrator user, execute the mc_ctl command in start mode.
Example)
$ mc_ctl start -M /mcdir/inst1
Switching to the primary server
To perform the maintenance on the primary server, execute the mc_ctl command in the switch mode on the primary server or the standby server.
Example)
$ mc_ctl switch -M /mcdir/inst1
When the switch is complete, the synchronous_standby_names parameter in the postgresql.conf file of the new primary server will be commented as follows:
Example)
#synchronous_standby_names = 'primary'
New standby server maintenance tasks
Stop the Mirroring Controller.
On the new standby server (the primary server before the switch), execute the mc_ctl command in stop mode.
Example)
$ mc_ctl stop -M /mcdir/inst1
Ensure that Mirroring Controller has completely stopped.
If the multiplexed instances and Mirroring Controller have been configured on the new standby server to start and stop automatically when the operating system of the database server is started or stopped, cancel the setting to start and stop automatically now.
See
Refer to "6.10 Setting Automatic Start and Stop of Mirroring Controller and Multiplexed Instances" for information on how to configure the multiplexed instances and Mirroring Controller to start and stop automatically when the operating system of the database server starts and stops.
As the OS superuser, execute the chkconfig command to disable automatic start and stop.
In the example below, the shell script for automatic start and stop was created as "rc_mc_inst1" and is disabled for run levels 3 and 5.
Example)
# chkconfig --level 35 rc_mc_inst1 off
As the OS superuser, execute the systemctl command to disable automatic start and stop.
The example below disables automatic start and stop of "mcoi_inst1.service".
Example)
# systemctl disable mcoi_inst1.service
Perform the maintenance on the new standby server that was stopped.
Create a copy of the new primary server instance on the new standby server.
Execute the mc_ctl command in setup mode to create data in the new standby server by synchronizing with the new primary server.
Example)
$ mc_ctl setup -M /mcdir/inst1 -r standby -U userName -h newPrimaryServerHostName -p newPrimaryServerPortNumber --standby-name=newStandbyServerName
See
The procedure for copying the primary server instance to the standby server is the same as the procedure for setting up the standby server.
Refer to "6.4.1 Setting up Database Multiplexing Mode on the Standby Server", and then perform the recovery.
Check the settings for automatic start and stop of the multiplexed instances and Mirroring Controller.
If the multiplexed instances and Mirroring Controller were configured in step 2 to not start and stop automatically when the operating system of the database server starts and stops, then change the settings back. This step can be skipped if automatic start and stop are not required.
As the OS superuser, execute the chkconfig command to enable the shell script.
In the example below, the shell script for automatic start and stop was created as "rc_mc_inst1" and is enabled for run levels 3 and 5.
Example)
# chkconfig --level 35 rc_mc_inst1 on
As the OS superuser, execute the systemctl command to enable automatic start and stop.
The example below disables automatic start and stop of "mcoi_inst1.service".
Example)
# systemctl enable mcoi_inst1.service
After the maintenance is complete, edit the following parameters in the postgresql.conf file of the standby server as required.
Copying an instance results in the value of the synchronous_standby_names parameter becoming the specified value on the primary server. Therefore, correct it to the specified value on the standby server. If the parameter was commented out, then you must uncomment it.
On the standby server, start (rebuild) Mirroring Controller.
As the instance administrator user, execute the mc_ctl command in start mode with the -w and -f options specified. This enables automatic switch and disconnection.
If you start Mirroring Controller and the instance without specifying the -f option, automatic switch and disconnection will not be enabled. To enable both, start Mirroring Controller and then execute the mc_ctl command in enable-failover mode, or restart Mirroring Controller with the -f option specified.
Example)
$ mc_ctl start -M /mcdir/inst1 -w -f
As the instance administrator user, execute the mc_ctl command in start mode with the -w option specified.
Example)
$ mc_ctl start -M /mcdir/inst1 -w
Failback of the Primary Server
Revert the primary server and standby server to the original server configuration. Do this to execute the main job on the previous primary server. Refer to "8.1.1.3 Failback of the Primary Server" for details.
Note
Obtain a backup as soon as this task is complete.