Chapter 7. Performing a switchover with ltcluster

Table of Contents

7.1. Preparing for switchover
7.1.1. Switchover and lt_rewind
7.2. Executing the switchover command
7.3. Caveats
7.4. Troubleshooting switchover issues
7.4.1. Demotion candidate (old primary) does not shut down
7.4.2. Switchover aborts with an "exclusive backup" error

A typical use-case for replication is a combination of primary and standby server, with the standby serving as a backup which can easily be activated in case of a problem with the primary. Such an unplanned failover would normally be handled by promoting the standby, after which an appropriate action must be taken to restore the old primary.

In some cases however it's desirable to promote the standby in a planned way, e.g. so maintenance can be performed on the primary; this kind of switchover is supported by the ltcluster standby switchover command.

ltcluster standby switchover differs from other ltcluster actions in that it also performs actions on other servers (the demotion candidate, and optionally any other servers which are to follow the new primary), which means passwordless SSH access is required to those servers from the one where ltcluster standby switchover is executed.

Note

ltcluster standby switchover performs a relatively complex series of operations on two servers, and should therefore be performed after careful preparation and with adequate attention. In particular you should be confident that your network environment is stable and reliable.

Additionally you should be sure that the current primary can be shut down quickly and cleanly. In particular, access from applications should be minimalized or preferably blocked completely. Also be aware that if there is a backlog of files waiting to be archived, LightDB will not shut down until archiving completes.

We recommend running ltcluster standby switchover at the most verbose logging level (--log-level=DEBUG --verbose) and capturing all output to assist troubleshooting any problems.

Please also read carefully the sections Preparing for switchover and Caveats below.