Skip to content
Permalink
Browse files

fix: as of v12 recovery.conf is no longer used for standby recovery. … (

#1355)

* fix: as of v12 recovery.conf is no longer used for standby recovery. settings are placed in postgresql.conf and recover.signal is used to signal recovery

* use standby.signal to tell server what mode to startup in, standby_mode is no longer used

* let pg_basebackup create the standby files
  • Loading branch information...
davecramer committed Nov 26, 2018
1 parent b8a8680 commit c4656b323f0dc3090926c0f14cd219461e534576
Showing with 8 additions and 11 deletions.
  1. +8 −11 .travis/travis_create_slaves.sh
@@ -3,7 +3,7 @@ set -x -e

if [ -z "$PG_VERSION" ]
then
echo "env PG_VERSION not define";
echo "env PG_VERSION not defined";
elif [ "x${PG_VERSION}" = "xHEAD" ]
then
PG_CTL="/usr/local/pgsql/bin/pg_ctl"
@@ -19,11 +19,8 @@ sudo mkdir -p ${PG_SLAVE1_DATADIR}
sudo chmod 700 ${PG_SLAVE1_DATADIR}
sudo chown -R postgres:postgres ${PG_SLAVE1_DATADIR}

sudo su postgres -c "$PG_BASEBACKUP -Upostgres -D ${PG_SLAVE1_DATADIR} -X stream"
sudo su postgres -c "$PG_BASEBACKUP -Upostgres -D ${PG_SLAVE1_DATADIR} -X stream -R"

sudo su postgres -c "echo standby_mode = \'on\' >${PG_SLAVE1_DATADIR}/recovery.conf"
sudo su postgres -c "echo primary_conninfo = \'host=localhost port=5432 user=test password=test\' >>${PG_SLAVE1_DATADIR}/recovery.conf"
sudo su postgres -c "echo recovery_target_timeline = \'latest\' >>${PG_SLAVE1_DATADIR}/recovery.conf"

if [[ "x${PG_VERSION}" != "xHEAD" ]]
then
@@ -38,6 +35,7 @@ then
sudo sed -i -e "/^[ \t]*hba_file.*/d" ${PG_SLAVE1_DATADIR}/postgresql.conf
sudo sed -i -e "/^[ \t]*ident_file.*/d" ${PG_SLAVE1_DATADIR}/postgresql.conf
sudo sed -i -e "s/^#\?hot_standby.*/hot_standby = on/g" ${PG_SLAVE1_DATADIR}/postgresql.conf

fi

#Start Slave 1
@@ -50,25 +48,24 @@ sudo mkdir -p ${PG_SLAVE2_DATADIR}
sudo chmod 700 ${PG_SLAVE2_DATADIR}
sudo chown -R postgres:postgres ${PG_SLAVE2_DATADIR}

sudo su postgres -c "$PG_BASEBACKUP -Upostgres -D ${PG_SLAVE2_DATADIR} -X stream"
sudo su postgres -c "$PG_BASEBACKUP -Upostgres -D ${PG_SLAVE2_DATADIR} -X stream -R"

sudo su postgres -c "echo standby_mode = \'on\' >${PG_SLAVE2_DATADIR}/recovery.conf"
sudo su postgres -c "echo primary_conninfo = \'host=localhost port=5432 user=test password=test\' >>${PG_SLAVE2_DATADIR}/recovery.conf"
sudo su postgres -c "echo recovery_target_timeline = \'latest\' >>${PG_SLAVE2_DATADIR}/recovery.conf"

if [[ "x${PG_VERSION}" != "xHEAD" ]]
then

sudo su postgres -c "echo 'local all all trust' > ${PG_SLAVE2_DATADIR}/pg_hba.conf"
sudo su postgres -c "echo 'host all all 127.0.0.1/32 trust' >> ${PG_SLAVE2_DATADIR}/pg_hba.conf"
sudo su postgres -c "echo 'host all all ::1/128 trust' >> ${PG_SLAVE2_DATADIR}/pg_hba.conf"

sudo su postgres -c "touch ${PG_SLAVE2_DATADIR}/pg_ident.conf"

sudo su postgres -c "cp -f ${PG_DATADIR}/postgresql.conf ${PG_SLAVE2_DATADIR}/postgresql.conf"
sudo su postgres -c "cp -f ${PG_DATADIR}/postgresql.conf ${PG_SLAVE2_DATADIR}/postgresql.conf"
sudo sed -i -e "/^[ \t]*data_directory.*/d" ${PG_SLAVE2_DATADIR}/postgresql.conf
sudo sed -i -e "/^[ \t]*hba_file.*/d" ${PG_SLAVE2_DATADIR}/postgresql.conf
sudo sed -i -e "/^[ \t]*ident_file.*/d" ${PG_SLAVE2_DATADIR}/postgresql.conf
sudo sed -i -e "s/^#\?hot_standby.*/hot_standby = on/g" ${PG_SLAVE2_DATADIR}/postgresql.conf


fi

#Start Slave 2

0 comments on commit c4656b3

Please sign in to comment.
You can’t perform that action at this time.