Skip to content

Instantly share code, notes, and snippets.

@diogob
Created June 21, 2010 14:11
Show Gist options
  • Save diogob/446898 to your computer and use it in GitHub Desktop.
Save diogob/446898 to your computer and use it in GitHub Desktop.
cd $HOME/pgsql90
./bin/psql -p 5433 postgres -c "SELECT pg_start_backup('teste');"
cp -r mestre escravo
rm -f escravo/pg_xlog/*
rm escravo/mestre.conf
rm escravo/postmaster.pid
sed -e "s/mestre\.conf/escravo.conf/" escravo/postgresql.conf > escravo/postgresql.conf.new
mv escravo/postgresql.conf.new escravo/postgresql.conf
echo "
listen_addresses = '*'
port = 5434
wal_level = minimal
archive_mode = off
hot_standby = on
" > escravo/escravo.conf
echo "
restore_command = 'cp /tmp/%f %p'
standby_mode = 'on'
primary_conninfo = 'host=localhost port=5433'
trigger_file = '/tmp/trigger.pgsql.5434'
" > escravo/recovery.conf
./bin/psql -p 5433 postgres -c "SELECT pg_stop_backup();"
./bin/postgres -D escravo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment