Database Reference
In-Depth Information
Getting ready
If you haven't read the recipes on Replication concepts and Replication best practice at the
start of this chapter, please go and read them now. Note that streaming replication refers to
the Master node as the primary node, and the two terms are used interchangeably.
How to do it...
Carry out the following steps:
1. Identify your Master and Standby nodes, and ensure that they have been configured
according to the best practice recipe.
2. Configure replication security. Create or confirm the existence of the replication user
on Master node
CREATE USER repuser
SUPERUSER
LOGIN
CONNECTION LIMIT 1
ENCRYPTED PASSWORD 'changeme';
3. Allow the replication user to authenticate. The following example allows access from
any ip address using encrypted password authentication; you may wish to consider
more restrictive options. Add the following line to the
host
replication repuser
127.0.0.1/0
md5
4. Set logging options in postgresql.conf on both Master and Standby, so that you get
increased information regarding replication connection attempts and associated
failures.
log_connections = on
5. Set max_wal_senders on Master in postgresql.conf, or increment if the value is
already non-zero.
max_wal_senders = 1
wal_mode = 'archive'
archive_mode = on
archive_command = 'cd .'
6. Adjust wal_keep_segments on Master in postgresql.conf. Set this to a value no higher
than the amount of freespace on the drive on which the pg_xlog directory is mounted,
divided by 16MB. If pg_xlog isn't mounted on a separate drive, then don't assume all
of the current freespace is available for transaction log files.
wal_keep_segments = 10000
# e.g. 160 GB
 
Search WWH ::




Custom Search