postgresql的默認最大連接數是200, 如果連接數超過200就會報 So many clients alreay. 當然你可以通過show max_connections;查看當前最大的連接數
修改最大連接數, 最重要的就是要修改shmmax(Maximum size of shared memory segment (bytes))
http://www.postgresql.org/docs/current/static/kernel-resources.html#SYSVIPC-PARAMETERS
這里有講解
這里講解都什么占用shm,(shared memory segment)
http://www.postgresql.org/docs/current/static/kernel-resources.html#SYSVIPC
這里有server start failed的信息描述
http://www.postgresql.org/docs/current/static/server-start.html#SERVER-START-FAILURES
在linux(CentOS)下修改shm可以用sysctl
1> sysctl -a 列出所有
sysctl -a | grep shmmax
2> sysctl -w 修改
sysctl -w kernel.shmmax=500000000(注意等號前后不能有空格)