Skip to content

Instantly share code, notes, and snippets.

@rdeguzman
Last active December 16, 2015 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdeguzman/5486127 to your computer and use it in GitHub Desktop.
Save rdeguzman/5486127 to your computer and use it in GitHub Desktop.
Postgres Replication with Archiving on Master.
When I set wal_level = 'archive' on master and hot_standby = 'off' in slave.
The slave won't start, replication user seem to authenticate, however the postgres
startup process seems to keep on trying.. why?
# master
wal_level = 'archive'
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 = off
================================================
LOG: entering standby mode
LOG: consistent recovery state reached at 6/A6000078
LOG: record with incorrect prev-link 6/93000020 at 6/A6000078
LOG: streaming replication successfully connected to primary
LOG: redo starts at 6/A6000078
LOG: connection received: host=[local]
FATAL: the database system is starting up
OG: connection received: host=[local]
FATAL: the database system is starting up
LOG: connection received: host=[local]
FATAL: the database system is starting up
LOG: connection received: host=[local]
Both postgres machine are on 9.0.12
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
# 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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment