Table of contents

Resync a PostgreSQL standby

To resync a standby from a primary run this on the affected standby:

sudo pg_resync_slave

It will ask you for a password. You can find this in the password store under govuk::node::s_postgresql_primary::standby_password.

You will see something like this:

vagrant@postgresql-standby-1:~$ sudo pg_resync_slave
36237/36237 kB (100%), 1/1 tablespace
pg_basebackup: base backup completed
 * Stopping PostgreSQL 9.3 database server                                 [ OK ]
 * Starting PostgreSQL 9.3 database server                                 [ OK ]

You can get a quick view of postgresql’s wal by doing the following:

on a postgresql-primary: ps -ef | grep sender

on a postgresql-standby: ps -ef | grep receiver

Restarting collectd

If you are resyncing because the standby has fallen too far behind primary, you might need to restart collectd on the standby machine to resolve the incinga alerts:

sudo service collectd restart
This page was last reviewed on 15 March 2019. It needs to be reviewed again on 15 September 2019 by the page owner #govuk-2ndline .
This page was set to be reviewed before 15 September 2019 by the page owner #govuk-2ndline. This might mean the content is out of date.