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

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: แก้ปัญหา Start PostgreSQL ไม่ได้ เจอ Error could not create shared memory segment: Invalid argument

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

โดย mindphp » 08/02/2018 6:59 pm

ปัญหามาจาก การตั้งค่า 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

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

โดย mindphp » 08/02/2018 6:43 pm

ลอง 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.

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

โดย mindphp » 08/02/2018 6:41 pm

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

ข้างบน