aboutsummaryrefslogtreecommitdiffstats
path: root/ops/robust-psql.md
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-07-01 12:36:46 -0400
committerDrew DeVault <sir@cmpwn.com>2020-07-01 12:36:46 -0400
commite428cd2445fef7404cdec3fbf9257ce1d8e39b7a (patch)
treed6201c3c162236d682b4579eb786277a530f158a /ops/robust-psql.md
parent65bbd6c63583281211bca10fcdbba68bd8f681bb (diff)
downloadsr.ht-docs-e428cd2445fef7404cdec3fbf9257ce1d8e39b7a.tar.gz
Fill out more psql procedures
Diffstat (limited to 'ops/robust-psql.md')
-rw-r--r--ops/robust-psql.md43
1 files changed, 34 insertions, 9 deletions
diff --git a/ops/robust-psql.md b/ops/robust-psql.md
index 20d0cbd..b378bf8 100644
--- a/ops/robust-psql.md
+++ b/ops/robust-psql.md
@@ -174,33 +174,58 @@ done
# Master demotion procedure
-TBD
+In this procedure, the server being demoted is referred to as the "old master"
+and the new master is referred to as such.
-Apparently this is somewhat involved
+1. Prerequisite: complete the standby promotion procedure
+1. Create a replication slot for the old master:
-✗ TODO: Test this process
+ SELECT * FROM pg_create_physical_replication_slot('name...');
+1. Create a user for the old master with login and replication privs
+1. Fill out `primary_slot_name` and `primary_conninfo` in the old master's
+ config, and set `hot_standby` to on
+1. Confirm that the old master has replication access in the new master's
+ `pg_hba.conf`
+1. Start the old master and monitor the logs, it should catch up
+1. Sanity check the database
-# Database upgrade procedure
+The old master is now the standby, and the old standby is now the master.
-TBD
+✓ Process tested
-✗ TODO: Test this process
+# Database upgrade procedure
## Minor version upgrades
-TBD
+This process will incur a short service degredation. The services will be in
+read-only mode for up to 10 minutes.
+
+1. Complete the failover procedure
+1. Perform the upgrade and restart the postgresql daemon
+1. Reverse the failover procedure
+1. Upgrade the standby and restart the standby
✗ TODO: Test this process
## Major version upgrades
-TBD
+This process will incur a longer service degredation. The services will be in
+read-only mode for up to 30 minutes.
+
+1. Complete the failover procedure
+1. Perform the upgrade and reboot the host
+1. Sanity check the database
+1. Reverse the failover procedure
+1. Complete the "Preparing the hot standby" procedure to rebuild the standby
+ from scratch; do system updates and reboot
✗ TODO: Test this process
# Accessing past data
-TBD
+The easiest way to do this is likely to be mounting an old version of the ZFS
+dataset on either the master or standby server, and running a secondary
+PostgreSQL instance from it.
✗ TODO: Test this process