Edit the file sysctl.conf:
vi /etc/sysctl.conf Add: kernel.sem = 250 512000 100 2048
For the settings to take effect, run:
Tuning Semaphore will solve the below problem during postgres startup:
FATAL: could not create semaphores: No space left on device DETAIL: Failed system call was semget(5432127, 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.