From a044b30465a93b6ac7437bd2d52ac773d2acde6f Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Tue, 10 Nov 2020 22:58:22 +1100 Subject: [PATCH] postgres: Fix replica not working when there are spaces in the password --- postgres/standby_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/postgres/standby_setup.sh b/postgres/standby_setup.sh index 12d7399..634d899 100644 --- a/postgres/standby_setup.sh +++ b/postgres/standby_setup.sh @@ -6,11 +6,11 @@ set -e 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 + 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 - 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 trigger_file = '/tmp/touch_to_promote_to_master' EOF