Last active
November 5, 2018 09:45
-
-
Save edib/ff4e5bbfeb8b24a374e23679dddc0149 to your computer and use it in GitHub Desktop.
postgresql multiple host and pgbacrest wall archive script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.