Monday, October 21, 2013

Postgres Replication with Archiving on Master.

Both postgres machine are on 9.0.12
 
When I set wal_level = 'hot_standby' on master and hot_standby = 'on' in slave.
It does do streaming repl but no archiving on master?
 
# master
wal_level = 'hot_standby'
archive_mode = on
archive_command = '../pgscripts/archive.sh %p %f'
 
# - Streaming Replication -
max_wal_senders = 3
wal_keep_segments = 8
 
# slave
wal_level = 'hot_standby'
archive_mode = on
archive_command = '../pgscripts/archive.sh %p %f'
checkpoint_segments = 8
hot_standby = on
 
master log:
------------------
LOG: connection received: host=[local]
LOG: connection authorized: user=pgsql database=postgres
LOG: connection received: host=192.168.4.223 port=56788
LOG: replication connection authorized: user=repuser host=192.168.4.223 port=56788
 
slave log:
------------------
LOG: entering standby mode
LOG: consistent recovery state reached at 6/B2000078
LOG: database system is ready to accept read only connections
LOG: streaming replication successfully connected to primary
LOG: connection received: host=[local]
LOG: connection authorized: user=pgsql database=postgres
Create recovery.conf
# Note that recovery.conf must be in $PGDATA directory.
 
# Specifies whether to start the server as a standby. In streaming replication,
# this parameter must to be set to on.
standby_mode = 'on'
 
# Specifies a connection string which is used for the standby server to connect
# with the primary.
primary_conninfo = 'host=192.168.4.233 port=5432 user=repuser password=changeme'
 
# Specifies a trigger file whose presence should cause streaming replication to
# end (i.e., failover).
trigger_file = '/var/db/pgsql_backup/postgresql.trigger.standby'
 
# Specifies a command to load archive segments from the WAL archive. If
# wal_keep_segments is a high enough number to retain the WAL segments
# required for the standby server, this may not be necessary. But
# a large workload can cause segments to be recycled before the standby
# is fully synchronized, requiring you to start again from a new base backup.
# restore_command = 'cp /var/db/pgsql_backup/archive/%f "%p"'
 
# archive_cleanup_command = 'pg_archivecleanup /var/db/pgsql_backup/archive %r'

No comments:

Post a Comment