PostgreSQL参数学习:wal_keep_segments

本文详细介绍了PostgreSQL中wal_keep_segments参数的作用与设置方法。该参数用于指定在pg_xlog目录下保留的最小数量的日志文件段数,以便备用服务器进行流复制。如果设置不当可能导致日志丢失及复制连接中断。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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会丢失,复制用到的连接会被断掉的。






本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/p/3355431.html,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值