From 0b63bc954f26d4118d64e791ae229403f30dd23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Fri, 18 Dec 2020 17:14:40 +0100 Subject: [PATCH] Add initial docs for PostgreSQL replication Document how to switch the PostgreSQL primary server to a standby, for the case where the primary goes down. Refs #217 --- doc/postgresql_replication.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 doc/postgresql_replication.md diff --git a/doc/postgresql_replication.md b/doc/postgresql_replication.md new file mode 100644 index 0000000..1abb906 --- /dev/null +++ b/doc/postgresql_replication.md @@ -0,0 +1,14 @@ +# Switch PostgreSQL primary + +Change the role in `./nodes/#{new_primary}.json`'s run list: + + - "role[postgresql_replica]", + + "role[postgresql_primary]", + +Delete the `role[postgresql_replica]` role from the old primary's run list. + +Run Chef on the new primary, then create the failover file to turn the server into the new primary: + + $ sudo touch /mnt/data/postgresql/failover.trigger + +Run Chef on servers that use PostgreSQL to change the IP of the primary server. \ No newline at end of file