2 jerryliun jerryliun 于 2017.09.06 10:22 提问

PostgreSQL initdb 过程中semget会报错

遇到PostgreSQL initdb 过程中semget报错,怎么办?
[sdbadmin@localhost bin]$ ./initdb -D /home/sdbadmin/pgdata/
The files belonging to this database system will be owned by user "sdbadmin".
This user must also own the server process.
The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
fixing permissions on existing directory /home/sdbadmin/pgdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 200
selecting default shared_buffers/max_fsm_pages ... 64000kB/100000
creating configuration files ... ok
creating template1 database in /home/sdbadmin/pgdata/base/1 ... 2016-08-19 04:26:38.377033 GMT,,,p13027,th-1860573088,,,,0,,,seg-10000,,,,,"WARNING","01000","""fsync"": can not be set by the user and will be ignored.",,,,,,,,"set_config_option","guc.c",10006,
loading file-system persistent tables for template1 ...
2016-08-19 04:26:43.826556 GMT,,,p13033,th173938784,,,,0,,,seg-10000,,,,,"WARNING","01000","""fsync"": can not be set by the user and will be ignored.",,,,,,,,"set_config_option","guc.c",10006,
2016-08-19 12:26:43.994570 CST,,,p13033,th173938784,,,,0,,,seg-10000,,,,,"FATAL","XX000","could not create semaphores: No space left on device (pg_sema.c:132)","Failed system call was semget(127, 17, 03600).","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 (currently 3000).
The PostgreSQL documentation contains more information about configuring your system for PostgreSQL.",,,,,,"InternalIpcSemaphoreCreate","pg_sema.c",132,1 0x88b8c2 sequoiasql errstart + 0x252
2 0x761a84 sequoiasql + 0x761a84
3 0x761d51 sequoiasql PGSemaphoreCreateInitVal + 0xf1
4 0x7b4dfd sequoiasql InitProcGlobal + 0x19d
5 0x7ab1dc sequoiasql CreateSharedMemoryAndSemaphores + 0x4ec
6 0x897659 sequoiasql BaseInit + 0x19
7 0x7c4228 sequoiasql PostgresMain + 0x958
8 0x6d51f5 sequoiasql main + 0x525
9 0x39d6e1ed1d libc.so.6 __libc_start_main + 0xfd
10 0x4b2d29 sequoiasql + 0x4b2d29
child process exited with exit code 1
initdb: removing contents of data directory "/home/sdbadmin/pgdata"


SequoiaDB_Official   2017.09.06 10:24

[root@localhost home]# cat /proc/sys/kernel/sem
250 32000 32 128
semmsl semmns semopm semmni

[root@localhost home]# sysctl -w kernel.sem="250 512000 100 2048"
kernel.sem = 250 512000 100 2048

[root@localhost home]# /sbin/sysctl -p

[root@localhost home]# sysctl -a |grep sem
kernel.sem = 250 512000 100 2048

Csdn user default icon