PGSQL优化后出错could not create semaphores: No space
admin
2023-05-20 22:42:36
0

服务器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

相关内容

热门资讯

缅甸发生5.2级地震,震源深度... 中国地震台网正式测定:05月18日10时05分在缅甸(北纬16.55度,东经96.25度)发生5.2...
大学校门如何正确地开放 武汉大学校门开放后的第一个周末,情况如我的预期。如部分游客存在爬树拍照打卡、在操场直播学生上体育课等...
文科改名潮:加了“智能”二字,... 过去几年里,“文科无用”“文科就业难”的讨论不断发酵。高校文科专业的变动也频繁且剧烈,据教育部数据,...
赛力斯申请多轴机器人运动轨迹校... 国家知识产权局信息显示,重庆赛力斯凤凰智创科技有限公司申请一项名为“多轴机器人运动轨迹校验方法、装置...
电信运营商开始卖Token,估... 2026年5月17日,中国电信正式推出了全国层面的试商用Token套餐,这标志着运营商的计费模式正从...
史上最大IPO,谁最躺赢? 今年科技IPO的热闹程度是空前的。 Cerebras刚刚在5月14日率先登场,发行价185美元,首日...
当“确定性”出现裂缝:迪拜的枢... 战争降临照片上是一幢写字楼,黑烟正从某一层往外冒,有几层的玻璃窗被完全击碎,窗框还挂着锯齿形的边角—...
视频丨“一部手机走天下” 中国... 从一线城市商圈到县域小店,从夜市摊贩到景区门票,在我们的日常生活中,二维码无处不在,移动支付普及率已...
2026世界电信和信息社会日报... 央广网南宁5月16日消息(记者梁瑜琳)在世界电信和信息社会日即将到来之际,5月15日,2026世界电...
当第一批丁克住进医院,关键时刻... 子女作为父母生命的延续和资源的继承者,自然该承担起养老的重担。而没有子女者住进医院,手术签字、术后付...