Skip to content

Instantly share code, notes, and snippets.

@amccloud
Created January 21, 2013 19:16
Show Gist options
  • Save amccloud/4588476 to your computer and use it in GitHub Desktop.
Save amccloud/4588476 to your computer and use it in GitHub Desktop.
# slave 10.0.1.3
sudo /etc/init.d/postgresql stop
sudo bash -c "rm -r /var/lib/postgresql/9.1/main/pg_xlog/*"
# master 10.0.1.2
sudo su - postgres
psql -c ";SELECT pg_start_backup('backup', true)";
rsync -av --rsync-path "sudo rsync" --exclude postmaster.pid --exclude pg_xlog /var/lib/postgresql/9.1/main/ vagrant@10.0.1.3:/var/lib/postgresql/9.1/main/
psql -c ";SELECT pg_stop_backup()";
# slave 10.0.1.3
sudo /etc/init.d/postgresql start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment