大网数据广告活动
服务器运维问答

PostgreSQL hot standby cannot start because max_connections is a lower setting than on the master

· 52CE 我爱测

I have a PostgreSQL 9.6 master and standby server each. Both this line in their respective postgresql.conf : max_connections = 100 The standby's recovery.conf looks as follows (actuals host , user , and cluster hidden): standby_m…

问题原文

原帖链接 · rookie09 · CC BY-SA 3.0

I have a PostgreSQL 9.6 master and standby server each. Both this line in their respective postgresql.conf:

max_connections = 100

The standby's recovery.conf looks as follows (actuals host, user, and cluster hidden):

standby_mode = on
recovery_target_timeline = latest
primary_conninfo = 'host=<host> port=5433 user=<user>'

When I pg_ctlcluster 9.6 <cluster> start the following error is reported:

FATAL: hot standby is not possible because max_connections = 100 
is a lower setting than on the master server (its value was 2000)

I am wondering: Where does the value 2000 come from. Both clusters should see 100, i.e. equal values. And indeed SHOW max_connections on the master yields 100.

What is going on here and how can I make the standby start successfully?

社区高分解答

原帖链接 · rookie09 · CC BY-SA 3.0

This occured because both my master and standby were initialized from a pg_basebackup that was taken on a cluster that indeed had max_connections = 2000. Details of the situation and two remedies are explained here:

[...] this is because pg_control on the standby remembers that the previous primary server's max_connections [...] So you'll either have to have higher settings on the standby for at least one restart or [...] simply start the standby for a second with hot_standby = off, and then re-enable it after it has replayed pending WAL.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-12-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。