|
|
@ -6,11 +6,11 @@ set -e
|
|
|
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
|
|
|
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
|
|
|
|
cat > ${PGDATA}/recovery.conf <<-EOF
|
|
|
|
standby_mode = on
|
|
|
|
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
|
|
|
|
# touch this file to promote this node to master
|
|
|
|
trigger_file = '/tmp/touch_to_promote_to_master'
|
|
|
|
trigger_file = '/tmp/touch_to_promote_to_master'
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|