Skip to content

Instantly share code, notes, and snippets.

@mchristopher
Created September 30, 2015 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mchristopher/87a4bb13f61e6bd1a196 to your computer and use it in GitHub Desktop.
Save mchristopher/87a4bb13f61e6bd1a196 to your computer and use it in GitHub Desktop.
postgresql replication script
#!/bin/bash
# Usage in postgresql.conf:
# archive_command = '/path/to/script.sh %p %f'
# Close out on error
set -e
wal_path=$1
wal_filename=$2
# Send to servers
rsync -a $wal_path postgresql@1.2.3.4:/var/lib/pgsql/data/archive/$wal_filename
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment