温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

PGSQL优化后出错could not create semaphores: No space

发布时间:2020-09-15 17:16:35 来源:网络 阅读:2210 作者:断臂人 栏目:数据库

服务器32G内存空间


参数优化

$ vi postgresql.conf

shared_buffers = 3072MB

max_connections = 4000

work_mem = 4MB

effective_cache_size = 4GB

maintenance_work_mem = 512MB 

wal_buffers = 256


具体优化参数解释参考:https://blog.csdn.net/zhousenshan/article/details/70233820


启动服务出错

$ pg_ctl -D /data/pg_data start

server starting

$ LOG:  could not create IPv6 socket: Address family not supported by protocol

FATAL:  could not create semaphores: No space left on device

DETAIL:  Failed system call was semget(5432124, 17, 03600).

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.

LOG:  database system is shut down


分析:

这是因为内核参数中共享内存的配置限制了最大连接数,具体参考博客:https://www.cnblogs.com/xiaotengyi/p/5439231.html


解决办法:

# vi /etc/sysctl.conf

kernel.sem = 50100 128256000 50100 2560


重载配置

# sysctl -p

vm.min_free_kbytes = 409600

vm.vfs_cache_pressure = 200

vm.swappiness = 0

fs.file-max = 6815744

fs.aio-max-nr = 1048576

kernel.sysrq = 1

kernel.sem = 50100 128256000 50100 2560

net.core.rmem_default = 2621440

net.core.wmem_default = 2621440

net.core.rmem_max = 2621440

net.core.wmem_max = 2621440

net.ipv4.tcp_rmem = 4096        655360   2621440

net.ipv4.tcp_wmem = 4096        655360   2621440

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI