PostgreSQL配置文件--复制

4 复制 REPLICATION

4.1 Sending Server(s)

4.1.1 max_wal_senders

数字型
默认: max_wal_senders = 10 , 为0表示启用流复制功能。
重启数据库生效
在主机(master)设置,是从机连接到master的并发连接数之和。
该并发连接数从进程上看,就是各个wal sender进程数之和。
该值不能超过系统的最大连接数(max_connections),可以允许超过实际的流复制用户数。

4.1.2 wal_keep_segments

数字型
默认: wal_keep_segments = 0   ,0表示禁止
xlog目录中最多容纳多少个wal日志文件,超过了则删掉最初的几个。
一个日志文件16M

4.1.3 wal_sender_timeout

数字型
默认: wal_sender_timeout = 60s  ,0表示禁止
设置流复制主机发送数据的超时时间

max_replication_slots = 10 # max number of replication slots (change requires restart)

track_commit_timestamp = off # collect timestamp of transaction commit (change requires restart)

4.2 Master Server

4.2.1 synchronous_standby_names

字符型
默认: synchronous_standby_names = '' 
standby servers that provide sync rep method to choose sync standbys, number of sync standbys, and comma-separated list of application_name from standby(s); '*' = all
同步流复制允许standby节点的名字

4.2.2 vacuum_defer_cleanup_age

数字型
默认: vacuum_defer_cleanup_age = 0
number of xacts by which cleanup is delayed

4.3、Standby Servers

4.3.1 hot_standby

布尔型
默认: hot_standby = on ,on和off二选一
重启数据库生效
从库上执行只读操作。off不允许从机查询
"off" disallows queries during recovery

4.3.2 max_standby_archive_delay

数字型
默认: max_standby_archive_delay = 30s ,-1 allows indefinite delay
max delay before canceling queries when reading WAL from archive
从归档读取wal时,取消查询前的最大延迟

4.3.3 max_standby_streaming_delay

数字型
默认: max_standby_streaming_delay = 30s ,-1 allows indefinite delay
max delay before canceling queries when reading streaming WAL
读取流式WAL时取消查询前的最大延迟
max_standby_archive_delay&max_standby_streaming_delay:standby节点查询表A时master节点已经删除了此表,则会发生冲突(因为standby节点必须replies),此参数就是等待冲突解决的时长。

4.3.4 hot_standby_feedback

布尔型
默认: hot_standby_feedback = off
send info from standby to prevent query conflicts
如果standby和master发生了冲突是否将此冲突信息反馈给master
建议关闭,以免备库长事务导致主库无法回收垃圾而膨胀。

4.3.5 wal_receiver_status_interval

数字型
默认: wal_receiver_status_interval = 10s    ,0表示禁止
send replies at least this often
多久向主报告一次从的状态,当然从每次数据复制都会向主报告状态,这里只是设置最长的间隔时间

4.3.6 wal_receiver_timeout

数字型
默认: wal_receiver_timeout = 60s   ,0表示禁止          
time that receiver waits for communication from master in milliseconds

4.3.7 wal_retrieve_retry_interval

数字型
默认: wal_retrieve_retry_interval = 5s
time to wait before retrying to retrieve WAL after a failed attempt

4.4 订阅者 Subscribers

该服务器为发布者,设置将会被屏蔽掉

4.4.1 max_logical_replication_workers

数字型
默认: max_logical_replication_workers = 4
taken from max_worker_processes
重启生效
最大的逻辑复制工作线程数

4.4.2 max_sync_workers_per_subscription

数字型
默认: max_sync_workers_per_subscription = 2 
每个订阅者的最大同步模式的工作线程数
posted @ 2017-12-14 17:50  lykops  阅读(403)  评论(0编辑  收藏  举报