Archive for July, 2011
Postgresql 9.0.4 replication
Posted by Victor Tong in PostgreSQL on July 6th, 2011
Postgresql 9.0.4 replication
I did a simple testing on Postgresql 9.0.4 replication configuration.
This is my flow for the setup. I hope these steps can help for your reference.
Environment:
Master = 192.168.0.82
Standby = 192.186.0.83
Install postgresql 9.0.4 on master and standby server
Edit postgresql.conf on master server
listen_addresses = '192.168.0.82'
Edit pg_hba.conf on master server
# The standby server must have superuser access privileges.
host replication postgres 192.168.0.83/32 trust
Edit postgresql.conf on master server
wal_level = hot_standby
max_wal_senders = 5
wal_keep_segments = 32
Stop postgresql on master server
tar data folder to a tar file (e.g. data.tgz)
on standby server
Stop postgresql
rename data folder
mv data data_org
untar data.tgz
Edit postgresql.conf on standby server
wal_level = minimal
max_wal_senders = 0
wal_keep_segments = 0
hot_standby = on
create and edit recovery.conf on standby server.
standby_mode = 'on'
primary_conninfo = 'host=192.168.0.10 port=5432 user=postgres'
Start postgresql on Master Server
Start postgresql on Standby Server
Grep the following information to verify that replication is running.
On Master:
ps -ef | grep sender
On Standby
ps -ef | grep receiver
You can use createdb to create database on master server. Then, this DB will be replicated to standby server.
You can use “psql -l” to list database on server.
Comments