PostgreSQL参数学习:wal_keep_segments

http://www.postgresql.org/docs/9.3/static/runtime-config-replication.html

参考官方文档:

wal_keep_segments (integer)
Specifies the minimum number of past log file segments kept in the pg_xlog directory, in case a standby server needs to fetch them for streaming replication. Each segment is normally 16 megabytes. If a standby server connected to the sending server falls behind by more than wal_keep_segments segments, the sending server might remove a WAL segment still needed by the standby, in which case the replication connection will be terminated. Downstream connections will also eventually fail as a result. (However, the standby server can recover by fetching the segment from archive, if WAL archiving is in use.)

This sets only the minimum number of segments retained in pg_xlog; the system might need to retain more segments for WAL archival or to recover from a checkpoint. If wal_keep_segments is zero (the default), the system doesn't keep any extra segments for standby purposes, so the number of old WAL segments available to standby servers is a function of the location of the previous checkpoint and status of WAL archiving. This parameter can only be set in the postgresql.conf file or on the server command line.

如果此值过小,那么在没有archive_log、而master很繁忙产生大量数据的前提下,wal log会丢失,复制用到的连接会被断掉的。

原文地址:https://www.cnblogs.com/gaojian/p/3355431.html