2

I am reading tutorials on how to setup streaming replication in Postgres from master to slave.

Some tutorials recommend setting up archiving in the master (and restoring in slave) . In the master, this needs to be set in the conf file:

wal_level = hot_standby
archive_mode = on
archive_command = 'some rsync command to rsync logfile segments from master to slave'

What is the purpose of this archiving? When is it not necessary when setting up streaming replication?

asked Feb 10, 2014 at 2:52
0

1 Answer 1

5

WAL archiving is useful when you're running streaming replication, because there's a limit to how much WAL the master will retain.

If you don't archive WAL, and the replica gets s far behind that the master has discarded WAL it still needs, it cannot recover and must be replaced with a fresh base backup from the master.

It's also useful for PITR for disaster recovery purposes.

answered Feb 10, 2014 at 3:10
4
  • is it too late to setup archiving when I already had the replication from master to slave running for a long time? If I can, should I restart the slave first? Commented Feb 10, 2014 at 3:23
  • @HenleyChiu You can start WAL archiving at any time. You'll need to restart the replica to set a recovery.conf entry for the restore_command. The master may also need restarting to set an archive_command. Commented Feb 10, 2014 at 3:24
  • should I restart the slave first then the master? Commented Feb 10, 2014 at 3:46
  • @HenleyChiu WAL archiving is asynchronous, so it doesn't really matter, does it? Commented Feb 10, 2014 at 4:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.