From fa1f305fda9fb3af963d82b7adb5f8c3ffa00c46 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Tue, 10 Nov 2020 23:16:27 +1100 Subject: [PATCH] postgres: Changes to work with version 12 In postgres 12, recovery.conf is removed in favor of normal config options plus a signal file. See https://www.2ndquadrant.com/en/blog/replication-configuration-changes-in-postgresql-12/ for a good rundown. --- postgres/standby_setup.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/postgres/standby_setup.sh b/postgres/standby_setup.sh index 634d899..2f29e53 100644 --- a/postgres/standby_setup.sh +++ b/postgres/standby_setup.sh @@ -7,12 +7,15 @@ if [ ! -s "$PGDATA/PG_VERSION" ]; then # get a binary backup of the database on $MASTER_NODE pg_basebackup -d "host=$MASTER_NODE password='$REPLICATION_PASSWORD' port=5432 user=$REPLICATION_USER" -D ${PGDATA} -vP - - cat > ${PGDATA}/recovery.conf <<-EOF - standby_mode = on + + # indicate postgres should start in hot standby mode + touch "$PGDATA/standby.signal" + + # write replication settings to config file + cat >> ${PGDATA}/postgresql.conf <<-EOF primary_conninfo = 'host=$MASTER_NODE password=\\'$REPLICATION_PASSWORD\\' port=5432 user=$REPLICATION_USER' # touch this file to promote this node to master - trigger_file = '/tmp/touch_to_promote_to_master' + promote_trigger_file = '/tmp/touch_to_promote_to_master' EOF chown postgres. ${PGDATA} -R