In PostgreSQL 9.2, is archiving required for streaming replication?
Is it allowed and/or reasonable to configure a master PostgreSQL 9.2 server to NOT archive but to perform streaming replication. That is configured as shown below:
wal_level = hot_standby
archive_mode = off
Can the "slave" server (hot standby), be configured to archive WAL segments?
wal_level = hot_standby
hot_standby = on
archive_mode = on
This would allow the archiving network traffic on the master server to be cut in half (replication but not archiving). This seems reasonable and the documentation appears to support this configuration but I'd prefer a bit of reassurance that we have a good configuration.
From documentation (strong added by myself):
If you use streaming replication without file-based continuous archiving, you have to set wal_keep_segments in the master to a value high enough to ensure that old WAL segments are not recycled too early, while the standby might still need them to catch up. If the standby falls behind too much, it needs to be reinitialized from a new base backup. If you set up a WAL archive that's accessible from the standby, wal_keep_segments is not required as the standby can always use the archive to catch up.
So, from my understanding, when you have too much transactions running, the slave could have some hard time to stay in sync. Especially if the master removes the WAL files before the slave really get what was inside. Without archive_mode
on the master the WAL files could be deleted without leaving any way to get them back.
If you keep the WAL archiving in place and add the streaming upon a working hot-standby-with-archives structure this cannot happen as the slave could always access archived WAL and will get back the unsynced transactions as soon as the lower activity on the stream allows it. Without access to the archive the risk is clearly to loose your slave integrity after some really heavy stuff.
链接地址: http://www.djcxy.com/p/77386.html