Skip to content

Instantly share code, notes, and snippets.

@edib
Last active November 5, 2018 09:45
Show Gist options
  • Select an option

  • Save edib/ff4e5bbfeb8b24a374e23679dddc0149 to your computer and use it in GitHub Desktop.

Select an option

Save edib/ff4e5bbfeb8b24a374e23679dddc0149 to your computer and use it in GitHub Desktop.
postgresql multiple host and pgbacrest wall archive script
#!/bin/bash
rsync -q -ae ssh $1 \ postgres@<replica1>:<xlog_archive_path>/$2
rsync -q -ae ssh $1 \ postgres@<replica2>:<xlog_archive_path>/$2
if [ $? != 0 ]
then
echo "Archiver error:"
exit 1
fi
pgbackrest --stanza=<stanza-name> archive-push $fullpath
if [ $? != 0 ]
then
echo "pgbackrest error: See logs"
exit 1
fi
exit 0
@edib
Copy link
Author

edib commented Sep 7, 2017

to run pgbackrest archive_command must be:
archive_command = '/var/lib/pgsql/9.6/rsyncwal.sh %p %f pgbackrest'
or this scripts name must be pgbackrest.sh something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment