Postgresql FATAL: could not create semaphores: No space left on device
2016-04-05 13:46
681 查看
今天做恢复的时候,数据库做完恢复后,无法启动报错
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
重新启动数据库并无报错
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
重新启动数据库并无报错
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) |
相关文章推荐
- Postgresql 系统相关函数介绍
- Postgresql 启动报错 FATAL: could not map anonymous shared memory
- django之创建第8个项目-数据库配置及同步研究
- mysql数据库主从配置
- Oracle SQL 基础知识
- Nginx NLB 及Redis学习
- Ubuntu安装Redis
- 我在工作中遇到的redis集群使用
- 三、go语言操作 mongodb mgo --go语言学习笔记
- 数据库设计三大范式
- MySQL 清除表空间碎片
- MySQL(2)--源码安装
- Oracle 数据库基础学习 (七) SQL语句综合练习
- maven加载oracle驱动问题
- MFC+Access数据库(ADO数据库编程)
- WCF遇到Oracle问题
- mysql dblink
- NoSQL数据库介绍(4)
- 一篇让Java程序猿随时可以翻看的Oracle总结
- 数据库行转列及逗号分隔转行