Created
August 11, 2014 11:55
-
-
Save hiroyuki-sato/0a9028b8e9004c6ec746 to your computer and use it in GitHub Desktop.
PostgreSQL BDR Quick start.
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
https://wiki.postgresql.org/wiki/BDR_Quick_Start | |
curl -s "http://git.postgresql.org/gitweb/?p=2ndquadrant_bdr.git;a=blob_plain;f=contrib/bdr/scripts/bdr_quickstart.sh;hb=refs/heads/bdr-next" | bash | |
export PATH=$HOME/2ndquadrant_bdr/bdr/bin:$PATH | |
initdb -D $HOME/2ndquadrant_bdr/bdr5598 -A trust -U postgres | |
initdb -D $HOME/2ndquadrant_bdr/bdr5599 -A trust -U postgres | |
pg_ctl -l $HOME/2ndquadrant_bdr/bdr5598.log -D $HOME/2ndquadrant_bdr/bdr5598 -o "-p 5598" -w start | |
pg_ctl -l $HOME/2ndquadrant_bdr/bdr5599.log -D $HOME/2ndquadrant_bdr/bdr5599 -o "-p 5599" -w start | |
createdb -p 5598 -U postgres bdrdemo | |
createdb -p 5599 -U postgres bdrdemo | |
cat >> $HOME/2ndquadrant_bdr/bdr5598/postgresql.conf <<EOF | |
# Generic settings required for BDR | |
#---------------------------------- | |
# Allow two other peer nodes, plus one for init_replica | |
max_replication_slots = 3 | |
# Two peer nodes, plus two slots for pg_basebackup | |
max_wal_senders = 4 | |
# Record data for logical replication | |
wal_level = 'logical' | |
track_commit_timestamp = on | |
# Load BDR | |
shared_preload_libraries = 'bdr' | |
EOF | |
cat >> $HOME/2ndquadrant_bdr/bdr5599/postgresql.conf <<EOF | |
# Generic settings required for BDR | |
#---------------------------------- | |
# Allow two other peer nodes, plus one for init_replica | |
max_replication_slots = 3 | |
# Two peer nodes, plus two slots for pg_basebackup | |
max_wal_senders = 4 | |
# Record data for logical replication | |
wal_level = 'logical' | |
track_commit_timestamp = on | |
# Load BDR | |
shared_preload_libraries = 'bdr' | |
EOF | |
cat >> $HOME/2ndquadrant_bdr/bdr5598/postgresql.conf <<EOF | |
# BDR connection configuration for node 5598 | |
#------------------------------------------- | |
bdr.connections = 'bdr5599' | |
bdr.bdr5599_dsn = 'dbname=bdrdemo user=postgres port=5599' | |
EOF | |
cat >> $HOME/2ndquadrant_bdr/bdr5599/postgresql.conf <<EOF | |
# BDR connection configuration for node 5599 | |
#------------------------------------------- | |
bdr.connections = 'bdr5598' | |
bdr.bdr5598_dsn = 'dbname=bdrdemo user=postgres port=5598' | |
bdr.bdr5598_init_replica = on | |
bdr.bdr5598_replica_local_dsn = 'dbname=bdrdemo user=postgres port=5599' | |
EOF | |
cat >> $HOME/2ndquadrant_bdr/bdr5598/pg_hba.conf <<EOF | |
local replication postgres trust | |
host replication postgres 127.0.0.1/32 trust | |
host replication postgres ::1/128 trust | |
EOF | |
cat >> $HOME/2ndquadrant_bdr/bdr5599/pg_hba.conf <<EOF | |
local replication postgres trust | |
host replication postgres 127.0.0.1/32 trust | |
host replication postgres ::1/128 trust | |
EOF | |
pg_ctl -l $HOME/2ndquadrant_bdr/bdr5598.log -D $HOME/2ndquadrant_bdr/bdr5598 -o "-p 5598" -w restart | |
pg_ctl -l $HOME/2ndquadrant_bdr/bdr5599.log -D $HOME/2ndquadrant_bdr/bdr5599 -o "-p 5599" -w restart | |
pg_ctl -l $HOME/2ndquadrant_bdr/bdr5598.log -D $HOME/2ndquadrant_bdr/bdr5598 -o "-p 5598" -w stop | |
pg_ctl -l $HOME/2ndquadrant_bdr/bdr5599.log -D $HOME/2ndquadrant_bdr/bdr5599 -o "-p 5599" -w stop | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment