postgresql出錯could not create semaphores: No space left on device


在postgres中,當max_connect設置過大,啟動的時候會報錯:

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

創建semaphores時空間參數不夠,查詢官網,有這么一段解釋:

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.
解決的方法是改小max_connect,當業務不允許的情況下,修改內核參數,max_connect相關的內核參數有:

 

 下面介紹如何修改內核參數

# 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
修改 vi /etc/sysctl.conf 的以下參數
kernel.sem = 50100 128256000 50100 2560
sysctl -p生效
重啟數據庫即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM