Trying to configure a master with two standby server vm's
Postrgresql.conf - Master Server VM
wal_level = hot_standby # minimal, archive, or hot_standby
# (change requires restart)
# - Archiving -
archive_mode = on # allows archiving to be done # (change requires restart)
archive_command = 'test ! -f /mnt/server/master_archivedir/%f && cp %p /mnt/server/master_archivedir/%f' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
#archive_timeout = 0 # force a logfile segment switch after this
# number of seconds; 0 disables
#------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------
# - Sending Server(s) -
# Set these on the master and on any standby that will send replication data.
max_wal_senders = 3 # max number of walsender processes
# (change requires restart)
_________________________________________________________________________________________________________
Postrgresql.conf - Slave1 Server VM
wal_level = hot_standby # minimal, archive, or hot_standby
# (change requires restart)
# - Archiving -
archive_mode = on # allows archiving to be done
# (change requires restart)
archive_command = 'test ! -f /mnt/server/slave1_archivedir/%f && cp %p /mnt/server/slave1_archivedir/%f' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
#archive_timeout = 0 # force a logfile segment switch after this
# number of seconds; 0 disables
#------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------
# - Sending Server(s) -
# Set these on the master and on any standby that will send replication data.
max_wal_senders = 3 # max number of walsender processes
# (change requires restart)
# - Standby Servers -
# These settings are ignored on a master server.
hot_standby = on
*** Completed this step, with 1.2.3.4 being the IP of slave1
psql -c "select pg_start_backup('initial_backup');"
rsync -cvar --inplace --exclude=*pg_xlog* /u01/fiber/postgreSQL_data/postgres@1.2.3.4:/u01/fiber/postgreSQL_data/
psql -c " select pg_stop_backup ();"
Now the issue is with the recovery.conf file on slave1, should the restore_command point to the archivelogs on the master?
Do I run the archive_cleanup_command when I recover slave1 or do I wait until I have finished backup/copy from the slave2
standby_mode = 'on'
primary_conninfo = 'host=<master database ip address> port=5432 dbname=tumsdb user=replication password=<password> application_name=slave1 sslmode=require'
restore_command = 'cp /mnt/server/master_archivedir/%f "%p%"' <--- **** Is this correct! **** The master remains on-line and is producing archive logs.
archive_cleanup_command = 'pg_archivecleanup /mnt/server/master_archivedir/ %r'
trigger_file= '/opt/PostgreSQL/9.3/data/pgsql.trigger.file'
______________________________________________________________________________________________________
Postrgresql.conf - Slave2 Server VM
wal_level = hot_standby # minimal, archive, or hot_standby
# (change requires restart)
# - Archiving -
archive_mode = on # allows archiving to be done
# (change requires restart)
archive_command = 'test ! -f /mnt/server/slave2_archivedir/%f && cp %p /mnt/server/slave2_archivedir/%f' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
#archive_timeout = 0 # force a logfile segment switch after this
# number of seconds; 0 disables
#------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------
# - Sending Server(s) -
# Set these on the master and on any standby that will send replication data.
max_wal_senders = 3 # max number of walsender processes
# (change requires restart)
# - Standby Servers -
# These settings are ignored on a master server.
hot_standby = on
*** I HAVE NOT COMPLETED this step yet from the master, with 1.2.3.5 being the IP of slave2. This takes about 3 days to finish the rsync copy
psql -c "select pg_start_backup('initial_backup');"
rsync -cvar --inplace --exclude=*pg_xlog* /u01/fiber/postgreSQL_data/postgres@1.2.3.5:/u01/fiber/postgreSQL_data/
psql -c " select pg_stop_backup ();"
Recovery.conf file slave2
standby_mode = 'on'
primary_conninfo = 'host=<master database ip address> port=5432 dbname=tumsdb user=replication password=<password> application_name=slave2 sslmode=require'
restore_command = 'cp /mnt/server/slave2_archivedir/%f "%p%"' <--- **** Is this correct! **** The master remains on-line and is producing archive logs.
archive_cleanup_command = 'pg_archivecleanup /mnt/server/slave2_archivedir/ %r'
trigger_file= '/opt/PostgreSQL/9.3/data/pgsql.trigger.file'
These directories reside on a share accessible to all three VM's
/mnt/server/master_archivedir
/mnt/server/slave1_archivedir
/mnt/server/slave2_archivedir
Thanks for any assistance.