Last active
May 18, 2020 19:07
-
-
Save codesenju/7266efa630865c7ab3ee47bf74e70d96 to your computer and use it in GitHub Desktop.
docker_setup_replication
This file contains 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
# configure postgresql for real-time replication | |
docker_setup_replication() { | |
psql -U postgres -c "CREATE USER replicator WITH REPLICATION ENCRYPTED PASSWORD 'passw0rd';" && \ | |
psql -U postgres -c "ALTER SYSTEM SET listen_addresses TO '*'" && \ | |
psql -U postgres -c "alter system set wal_level = replica ;" && \ | |
psql -U postgres -c "alter system set max_wal_senders = 18;" && \ | |
psql -U postgres -c "alter system set hot_standby = on;" && \ | |
echo host replication replicator 0.0.0.0/0 trust >> "$PGDATA/pg_hba.conf" | |
echo "User Replicator added!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment