PostgreSQL Replication Setup
1. Master
Replication Setup
listen_addresses *
wal_level Replica
hot_standby on
create user repuser with replication encrypted password 'password';
host all all 0.0.0.0/0 trust
host replication repuser 10.75.0.0/16 md5
2. Slave
remove all the file in data directory
Clone from master
pg_basebackup -h master_hostname -U repuser -p 5434 -D /postgres_dbpoc1/databases -Fp -Xs -P -R -C -S pgstandby_new
-h=host
-U=user
-p=Port
-D=data directory
-F=format (plain or tar)
-p=plain
-X=wal method ( none || fetch || stream)
-s=stream
-P=Progress
-R=write configuration for replication.
-C=Creation of replication slot named by the -S option
-S=name of the replication slot.
3. Status
select pg_is_in_recovery();
Comments
Post a Comment