1. 首页
  2. 数据库运维
  3. PostgreSQL

postgresql数据库服务器启动失败

这周postgresql终于发布了9.3正式版,公司领导让我在新服务器上安装9.3。安装过程一切顺利,然后按照我们现在的配置修改了下postgresql.conf文件。但是重启的时候却出现如下错误:


postgres@newdata:~$ /opt/PostgreSQL/9.3/bin/pg_ctl start -D /data1/pgsql93
server starting
postgres@newdata:~$ 2013-09-11 13:01:21 CST [3042]: [1-1] user=,db=,host= FATAL: could not create semaphores: No space left on device
2013-09-11 13:01:21 CST [3042]: [2-1] user=,db=,host= DETAIL: Failed system call was semget(3555120, 17, 03600).
2013-09-11 13:01:21 CST [3042]: [3-1] user=,db=,host= HINT: This error does *not* mean that you have run out of disk space. It occurs when either the system limit for the maximum number of semaphore sets (SEMMNI), or the system wide maximum number of semaphores (SEMMNS), would be exceeded. You need to raise the respective kernel parameter. Alternatively, reduce PostgreSQL's consumption of semaphores by reducing its max_connections parameter.
 The PostgreSQL documentation contains more information about configuring your system for PostgreSQL.

could not create semaphores: No space left on device”,按照字面上的意思感觉是说我的磁盘空间不足,其实不然。我把postgresql.conf配置文件又换成和初始状态一样,重启是正常的。参考资料,这句话的意思原来是你的内核的System V信号灯的限制小于 PostgreSQL 想创建的数量。我在postgresql.conf文件中修改最大连接数是2500个,即max_connections = 2500,默认值是100。

最后修改/etc/sysctl.conf系统内核文件,在后面添加如下代码解决postgresql服务器启动连接数错误的问题。


# added for postgresql
kernel.shmmax = 203243925504
kernel.shmall = 49620099
kernel.sem = 5010 1282560 5010 256
kernel.sched_migration_cost = 5000000
kernel.sched_autogroup_enabled = 0

参考网址:

http://www.php100.com/manual/PostgreSQL8/postmaster-start.html#POSTMASTER-START-FAILURES

http://www.php100.com/manual/PostgreSQL8/kernel-resources.html#SYSVIPC

联系我们

0574-55011290

QQ:248687950

邮件:admin@nbhao.org

工作时间:周一至周五,9:00-18:00,节假日休息

QR code