Postgres slave max_connections = master's max_connections?

I am using binary replication for Postgres.

Is it true that the max_connections has to be the SAME for both the master and slave in postgresql.conf?

Can they be different?

Answers


The documentation has something to say about it [emphasis mine - ed.]:

When running a standby server, you must set this parameter to the same or higher value than on the master server. Otherwise, queries will not be allowed in the standby server.

There are a number of reasons to try to keep your hardware and configuration as close to identical as possible. So I think a strict reading of your question is no. But there are good reasons to keep it the same.

The big reasons have to do with two things: base backups and fail over. If you are taking base backups from the slave then the base backup also includes the configuration. If you later restore it on the master, then you have configuration changes taking place solely because you restored a backup. In a disaster recovery situation, the last thing you want is to be trying to track down "what changed when we restored the backup?!"

The second thing is that this applies in more or less the same way when failing over. Because failing back is still a bit of a pain, you need to be assuming your slave can handle the master's load for a bit of time while you set things up. Keeping the configuration the same is a good way to avoid unpleasant surprises there.


It a general convention to follow as the master and slave always synchronized themselves.. but you can change it depending your kernel buffer size and shared_buffers size you are allocating for each transaction in postgresql.conf file. so don't worry you can change the number of connection but for that you can get some more error.


Need Your Help

Alternative to Win32_Product?

powershell wmi-query

Well, well. After playing around with querying Win32_Product to find a software version, I couldn't understand why the results were so dog-slow. As much as 15 times slower than querying Win32_servi...

Proper way to check for memory leaks in Visual C++

c++ c arraylist memory-leaks

I've been trying to improve my own personal C++ skills lately, so I implemented an Array List as a learning exercise. After I got it working, I started checking for memory leaks, and became very