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.
pull/197/head
Mike Lang 4 years ago committed by Mike Lang
parent a044b30465
commit fa1f305fda

@ -8,11 +8,14 @@ if [ ! -s "$PGDATA/PG_VERSION" ]; then
# get a binary backup of the database on $MASTER_NODE # 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 pg_basebackup -d "host=$MASTER_NODE password='$REPLICATION_PASSWORD' port=5432 user=$REPLICATION_USER" -D ${PGDATA} -vP
cat > ${PGDATA}/recovery.conf <<-EOF # indicate postgres should start in hot standby mode
standby_mode = on 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' primary_conninfo = 'host=$MASTER_NODE password=\\'$REPLICATION_PASSWORD\\' port=5432 user=$REPLICATION_USER'
# touch this file to promote this node to master # 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 EOF
chown postgres. ${PGDATA} -R chown postgres. ${PGDATA} -R

Loading…
Cancel
Save