หน้า 1 จากทั้งหมด 1

แก้ปัญหา Start PostgreSQL ไม่ได้ เจอ Error could not create shared memory segment: Invalid argument

โพสต์แล้ว: 08/02/2018 6:41 pm
โดย mindphp
แก้ปัญหา Start PostgreSQL ไม่ได้
เจอ Error
could not create shared memory segment: Invalid argument

Re: แก้ปัญหา Start PostgreSQL ไม่ได้ เจอ Error could not create shared memory segment: Invalid argument

โพสต์แล้ว: 08/02/2018 6:43 pm
โดย mindphp
ลอง restart เจอ Error ประมาณ นี้
sudo service postgresql restart
* Restarting PostgreSQL 9.1 database server * The PostgreSQL server failed to start. Please check the log output:
2018-02-08 18:42:36 ICT FATAL: could not create shared memory segment: Invalid argument
2018-02-08 18:42:36 ICT DETAIL: Failed system call was shmget(key=5678001, size=288940032, 03600).
2018-02-08 18:42:36 ICT HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 288940032 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memory configuration.

Re: แก้ปัญหา Start PostgreSQL ไม่ได้ เจอ Error could not create shared memory segment: Invalid argument

โพสต์แล้ว: 08/02/2018 6:59 pm
โดย mindphp
ปัญหามาจาก การตั้งค่า shared memory มากเกินไป
วิธีแก้
nano /etc/postgresql/[pgsqql เวอร์ชั่น]/main/postgresql.conf
เช่น

โค้ด: เลือกทั้งหมด

nano /etc/postgresql/9.1/main/postgresql.conf
แก้
shared_buffers = 128MB #24MB

สำหรับเครื่อง ram 1-2 GB
เติมค่า

โค้ด: เลือกทั้งหมด

sysctl -w kernel.shmmax=134217728
$ sysctl -w kernel.shmall=2097152