Book Image

PostgreSQL Replication, Second Edition

Book Image

PostgreSQL Replication, Second Edition

Overview of this book

Table of Contents (22 chapters)
PostgreSQL Replication Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Common maintenance tasks


Let's now take a look at some common maintenance tasks.

Performing maintenance on a single node

Pacemaker has a built-in notion of bringing a node down for maintenance. This is called standby mode. This mode is also used for enforced failover.

You can activate it like this:

pcs cluster standby db1

If this command is issued on the master, it causes Pacemaker to try to gracefully shut down PostgreSQL. If the shutdown takes more than 110 seconds, a forced kill of PostgreSQL is tried. If this fails, the node is rebooted. Then Pacemaker moves the master IP over to the other node and promotes the chosen PostgreSQL slave to the master role. It is recommended that you issue a CHECKPOINT command on the master prior to doing this step in order to minimize downtime.

For slave nodes, this directive only stops PostgreSQL.

Then wait for the failover to complete:

crm_mon

At this point, your maintenance tasks can be performed.

Tip

Important! Remember to remove /pgsql/run/PGSQL.lock after...