Postgresql FATAL: could not create semaphores: No space left on device
2016-04-27 15:59
253 查看
昨天安装完成pg 9.5后,启动报错:
FATAL: could not create semaphores: No space left on device
DETAIL: Failed system call was semget(xxxxxxxxxx).
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.
查看报错日志是由于内核的相关配置参数设置过小引起的。
这里是共享内存段的限制,简单介绍一下
如果数据库报FATAL: could not create shared memory segment:Cannot allocate memory 错误,可以考虑修改以下相关参数
SHMMAX 单个共享内存段最大字节数
SHMMNI 共享内存段最大个数
SHMALL系统中共享内存也总数,至少为ceil(shmmax/PAGE_SIZE)
获取page_size值
可以根据实际情况修改以上参数值,在/etc/sysctl.conf配置文件中
今天遇到的错误,主要解决以下参数的限制才能解决我们数据库启动的报错
SEMMSL 每个信号量set中信号量最大个数
SEMMNS linux系统中信号量最大个数
SEMOPM semop系统调用允许的信号量最大个数设置,设置成和SEMMSL一样即可
SEMMNI linux系统信号量set最大个数
所以SEMMNS=SEMMSL*SEMMNI
所以要么增大信号量,要么减少max_connect参数
这里我选择增大信号量
修改 vi /etc/sysctl.conf 的以下参数
kernel.sem = 50100 128256000 50100 2560
ipcs -ls
------ Semaphore Limits --------
max number of arrays = 2560
max semaphores per array = 50100
max semaphores system wide = 128256000
max ops per semop call = 50100
semaphore max value = 32767
重新启动数据库后无报错,数据库可以正常启动。
下面是官方文档中对semaphores相关参数的说明:
参考: http://blog.163.com/dazuiba_008/blog/static/363349812016314739538/ http://www.postgresql.org/docs/9.4/static/kernel-resources.html#SYSVIPC-PARAMETERS
FATAL: could not create semaphores: No space left on device
DETAIL: Failed system call was semget(xxxxxxxxxx).
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.
查看报错日志是由于内核的相关配置参数设置过小引起的。
这里是共享内存段的限制,简单介绍一下
如果数据库报FATAL: could not create shared memory segment:Cannot allocate memory 错误,可以考虑修改以下相关参数
#ipcs -lm ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 67108864 max total shared memory (kbytes) = 17179869184 min seg size (bytes) = 1
#cat /proc/sys/kernel/shmmax 68719476736
SHMMAX 单个共享内存段最大字节数
# cat /proc/sys/kernel/shmmni 4096
SHMMNI 共享内存段最大个数
# cat /proc/sys/kernel/shmall 4294967296
SHMALL系统中共享内存也总数,至少为ceil(shmmax/PAGE_SIZE)
获取page_size值
# getconf PAGE_SIZE 4096
可以根据实际情况修改以上参数值,在/etc/sysctl.conf配置文件中
今天遇到的错误,主要解决以下参数的限制才能解决我们数据库启动的报错
# ipcs -ls ------ Semaphore Limits -------- max number of arrays = 1280 max semaphores per array = 50100 max semaphores system wide = 64128000 max ops per semop call = 50100 semaphore max value = 32767 # cat /proc/sys/kernel/sem SEMMSL SEMMNS SEMOPM SEMMNI 50100 128256000 50100 2560
SEMMSL 每个信号量set中信号量最大个数
SEMMNS linux系统中信号量最大个数
SEMOPM semop系统调用允许的信号量最大个数设置,设置成和SEMMSL一样即可
SEMMNI linux系统信号量set最大个数
所以SEMMNS=SEMMSL*SEMMNI
所以要么增大信号量,要么减少max_connect参数
这里我选择增大信号量
修改 vi /etc/sysctl.conf 的以下参数
kernel.sem = 50100 128256000 50100 2560
ipcs -ls
------ Semaphore Limits --------
max number of arrays = 2560
max semaphores per array = 50100
max semaphores system wide = 128256000
max ops per semop call = 50100
semaphore max value = 32767
重新启动数据库后无报错,数据库可以正常启动。
下面是官方文档中对semaphores相关参数的说明:
Name | Description | Reasonable values |
---|---|---|
SHMMAX | Maximum size of shared memory segment (bytes) | at least 1kB (more if running many copies of the server) |
SHMMIN | Minimum size of shared memory segment (bytes) | 1 |
SHMALL | Total amount of shared memory available (bytes or pages) | if bytes, same as SHMMAX; if pages, ceil(SHMMAX/PAGE_SIZE) |
SHMSEG | Maximum number of shared memory segments per process | only 1 segment is needed, but the default is much higher |
SHMMNI | Maximum number of shared memory segments system-wide | like SHMSEG plus room for other applications |
SEMMNI | Maximum number of semaphore(打旗语) identifiers (i.e., sets) | at least ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5) / 16) |
SEMMNS | Maximum number of semaphores system-wide | ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5) / 16) * 17 plus room for other applications |
SEMMSL | Maximum number of semaphores(信号) per set | at least 17 |
SEMMAP | Number of entries in semaphore map | see text |
SEMVMX | Maximum value of semaphore | at least 1000 (The default is often 32767; do not change unless necessary) |
相关文章推荐
- mysql truncate/delete/drop 删除表数据
- oracle里存的是number类型,java查询出来的对象属性是bigdecimal类型,该怎么解决?
- Mysql 一些常用的指令
- MySQL创建用户与授权方法
- sql 同一个字段多个信息拼接
- django数据库时间存储格式问题
- redis 集群搭建 Ubuntu
- oracle sql优化
- SQL怎么输出前n个记录? n是中间计算得到的,不支持变量传递
- 软考高项学员:2016年4月26日作业
- MySQL不存在则创建数据库数据表
- linux redis安装
- redis单机安装
- MYSQL 的几种join连接方式
- SQLserver2008 要修改表的标识列没法修改,不能在Navicat中修改标识列
- Oracle kill inactive 线程
- SQL Sever触发器的基本语法与作用
- mysql基础类型知识总结
- SQLite一些函数用法
- plsql快捷键及使用优化