PostgreSQL配置文件--复制

来源:互联网 发布:淘宝客新手如何玩鹊桥 编辑:程序博客网 时间:2024/06/05 02:09

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 = 0number 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 delaymax 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 delaymax 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 = offsend 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 = 5stime 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 = 4taken from max_worker_processes重启生效最大的逻辑复制工作线程数

4.4.2 max_sync_workers_per_subscription

数字型默认: max_sync_workers_per_subscription = 2 每个订阅者的最大同步模式的工作线程数