[แก้ไขได้แล้ว] เจอปัญหา Service Php-fpm กับ mysqld สลับกันค้าง

[COLOR=#ff0000][SIZE=4]** แก้อาการค้างได้แล้วครับ ผม build ใหม่ เอา php-fpm ออกตอนนี้หายค้างเลย งง แต่อยากรู้ว่าเกิดจากอะไร ต่อไปจะได้หาทางแก้ไขและใช้ php-fpm ได้ครับ
[/SIZE][/COLOR]

เพิ่งเคยเจออาการแบบนี้ครับ ขอเล่าตั้งแต่เมื่อก่อนตอนใช้เครื่องเซิฟเวอร์เก่า ใช้ apache + memcache + php v.5.4 + mysqld ของ Directadmin Custombuild1.2 ใช้งานได้ตามปกติมาตลอด แต่พอย้ายมาเซิฟเวอร์ใหม่ เปลี่ยนมาใช้เป็น apache + php-fpm56 + php v.5.6 + mysqld ลงอัตโนมัติตามที่ DA มันแนะนำ Custombuild2.0 เจอปัญหา process apache + php-fpm เต็มจนค้าง ก็เลยลองจูน mysqld ไฟล์ my.cnf ค่าเดิมเหมือนแต่ก่อน คนก็เข้าประมาณเท่าเดิม แต่พอจูน mysqld กลับ apache + php-fpm วิ่งปกติ แต่ mysqld ค้าง แทนซะงั้นครับ แต่พอ Restart Service ก็ใช้ได้เหมือนเดิมตามปกติ แต่พออีก 1 วันถัดมาก็จะเป็นอาการเดิมอีกครับ

งงเลยไม่เคยเจอแบบนี้มาก่อน ลองจูนเพิ่ม ยิ่งค้างเร็วกว่าเดิม :189bbdde:

ขอถามผู้รู้หน่อยหน่ะครับ ขอบคุณล่วงหน้าครับ TT___TT

แคปรูปช่วงที่ค้าง

directadmin service monitor

apache status

Error log

[Tue Jan 19 00:10:05.373484 2016] [core:warn] [pid 21303:tid 139955457517504] AH00045: child process 6332 still did not exit, sending a SIGTERM
[Tue Jan 19 00:10:07.375460 2016] [core:warn] [pid 21303:tid 139955457517504] AH00045: child process 6332 still did not exit, sending a SIGTERM
[Tue Jan 19 00:10:09.377744 2016] [core:warn] [pid 21303:tid 139955457517504] AH00045: child process 6332 still did not exit, sending a SIGTERM
[Tue Jan 19 00:10:11.380047 2016] [mpm_event:notice] [pid 21303:tid 139955457517504] AH00494: SIGHUP received. Attempting to restart
[Tue Jan 19 00:10:11.396304 2016] [auth_digest:notice] [pid 21303:tid 139955457517504] AH01757: generating secret for digest authentication …
[Tue Jan 19 00:10:12.006713 2016] [ssl:warn] [pid 21303:tid 139955457517504] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 00:10:12.006966 2016] [lbmethod_heartbeat:notice] [pid 21303:tid 139955457517504] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 19 00:10:12.015644 2016] [mpm_event:notice] [pid 21303:tid 139955457517504] AH00489: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips configured – resuming normal operations
[Tue Jan 19 00:10:12.015707 2016] [core:notice] [pid 21303:tid 139955457517504] AH00094: Command line: ‘/usr/sbin/httpd -D SSL’
[Tue Jan 19 00:11:10.004955 2016] [ssl:warn] [pid 18895:tid 139626474739648] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 00:11:10.005239 2016] [suexec:notice] [pid 18895:tid 139626474739648] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 19 00:11:10.019353 2016] [auth_digest:notice] [pid 18896:tid 139626474739648] AH01757: generating secret for digest authentication …
[Tue Jan 19 00:11:11.005905 2016] [ssl:warn] [pid 18896:tid 139626474739648] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 00:11:11.006162 2016] [lbmethod_heartbeat:notice] [pid 18896:tid 139626474739648] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 19 00:11:11.013258 2016] [mpm_event:notice] [pid 18896:tid 139626474739648] AH00489: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips configured – resuming normal operations
[Tue Jan 19 00:11:11.013356 2016] [core:notice] [pid 18896:tid 139626474739648] AH00094: Command line: ‘/usr/sbin/httpd -D SSL’
[Tue Jan 19 01:46:28.335336 2016] [mpm_event:notice] [pid 18896:tid 139626474739648] AH00491: caught SIGTERM, shutting down
[Tue Jan 19 01:46:29.008033 2016] [ssl:warn] [pid 1722:tid 139936968148928] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 01:46:29.008465 2016] [suexec:notice] [pid 1722:tid 139936968148928] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 19 01:46:29.026792 2016] [auth_digest:notice] [pid 1723:tid 139936968148928] AH01757: generating secret for digest authentication …
[Tue Jan 19 01:46:30.008222 2016] [ssl:warn] [pid 1723:tid 139936968148928] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 01:46:30.008592 2016] [lbmethod_heartbeat:notice] [pid 1723:tid 139936968148928] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 19 01:46:30.020054 2016] [mpm_event:notice] [pid 1723:tid 139936968148928] AH00489: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips configured – resuming normal operations
[Tue Jan 19 01:46:30.020214 2016] [core:notice] [pid 1723:tid 139936968148928] AH00094: Command line: ‘/usr/sbin/httpd -D SSL’
[Tue Jan 19 01:48:47.008038 2016] [ssl:warn] [pid 2337:tid 140075516348352] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 01:48:47.008494 2016] [suexec:notice] [pid 2337:tid 140075516348352] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 19 01:48:47.026974 2016] [auth_digest:notice] [pid 2338:tid 140075516348352] AH01757: generating secret for digest authentication …
[Tue Jan 19 01:48:48.008415 2016] [ssl:warn] [pid 2338:tid 140075516348352] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 01:48:48.008790 2016] [lbmethod_heartbeat:notice] [pid 2338:tid 140075516348352] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 19 01:48:48.018932 2016] [mpm_event:notice] [pid 2338:tid 140075516348352] AH00489: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips configured – resuming normal operations
[Tue Jan 19 01:48:48.019072 2016] [core:notice] [pid 2338:tid 140075516348352] AH00094: Command line: ‘/usr/sbin/httpd -D SSL’
[Tue Jan 19 06:37:59.603467 2016] [core:error] [pid 26767:tid 140075448096512] [client 89.190.51.21:44190] AH00126: Invalid URI in request GET HTTP/1.1 HTTP/1.1
[Tue Jan 19 06:38:00.100010 2016] [cgi:error] [pid 26767:tid 140075220293376] [client 89.190.51.21:44201] AH02811: script not found or unable to stat: /var/www/cgi-bin/php4
[Tue Jan 19 06:38:00.589427 2016] [cgi:error] [pid 31411:tid 140074989516544] [client 89.190.51.21:44218] AH02811: script not found or unable to stat: /var/www/cgi-bin/php5
[Tue Jan 19 06:38:01.581461 2016] [cgi:error] [pid 26767:tid 140074832168704] [client 89.190.51.21:44252] AH02811: script not found or unable to stat: /var/www/html/index.cgi
[Tue Jan 19 06:38:02.087101 2016] [cgi:error] [pid 31411:tid 140075010496256] [client 89.190.51.21:44259] AH02811: script not found or unable to stat: /var/www/cgi-bin/php
[Tue Jan 19 06:38:02.589371 2016] [cgi:error] [pid 31411:tid 140075325191936] [client 89.190.51.21:44271] AH02811: script not found or unable to stat: /var/www/cgi-bin/php5-cli
[Tue Jan 19 06:38:04.579380 2016] [cgi:error] [pid 31411:tid 140074769229568] [client 89.190.51.21:44328] AH02811: script not found or unable to stat: /var/www/cgi-bin/php.fcgi
[Tue Jan 19 06:38:05.075051 2016] [cgi:error] [pid 31411:tid 140074979026688] [client 89.190.51.21:44340] AH02811: script not found or unable to stat: /var/www/cgi-bin/index.cgi
[Tue Jan 19 08:21:03.722990 2016] [cgi:error] [pid 25420:tid 140074800699136] [client 115.230.124.164:2085] AH02811: script not found or unable to stat: /var/www/cgi-bin/common
[Tue Jan 19 09:59:04.007129 2016] [ssl:warn] [pid 17268:tid 140061674502080] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 09:59:04.007432 2016] [suexec:notice] [pid 17268:tid 140061674502080] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 19 09:59:04.021038 2016] [auth_digest:notice] [pid 17269:tid 140061674502080] AH01757: generating secret for digest authentication …
[Tue Jan 19 09:59:05.008280 2016] [ssl:warn] [pid 17269:tid 140061674502080] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jan 19 09:59:05.008669 2016] [lbmethod_heartbeat:notice] [pid 17269:tid 140061674502080] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 19 09:59:05.019306 2016] [mpm_event:notice] [pid 17269:tid 140061674502080] AH00489: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips configured – resuming normal operations
[Tue Jan 19 09:59:05.019471 2016] [core:notice] [pid 17269:tid 140061674502080] AH00094: Command line: ‘/usr/sbin/httpd -D SSL’

ค้างยังไง จูนยังไงครับ

mytop ดูแล้วยัง apache status ดูแล้วยัง

มี error อะไรให้ได้แก้ไขไหมครับ

error log httpd ว่าไงครับ

พอดีวันนี้เมื่อตอน 11.00น. มันค้างแล้วรีไปก่อน ลืมเซฟรูปไว้ครับ เดี๋ยวมันค้างอีกรอบ จะรีบเซฟมาให้ดูนะครับ

กำลังทยอยอัพรูป สถานะ ปัจจุบัน ช่วงปกติ

เซิฟเวอร์ใช้ VPS + CPU แชร์ 8Cores + RAM 12GB

Apache Status

Top

my.cnf

ที่บอกว่า process เต็มจนค้างนี่หมายถึง RAM เต็มใช่ไหมครับ
แล้วที่บอกว่าจูน MySQL ใหม่ แล้ว Apache หาย คือไปลงพวก buffer pool ให้เล็กลงรึเปล่าหว่า?

ถ้าปกติ Apache เยอะจนกิน RAM จนเต็มแสดงว่าตั้งค่า MaxClient ไว้สูงเกิน
เท่าที่ดูจาก Server status รู้สึกจะใช้ MPM แบบ event ที่มันจะแตก thread หลายตัว (1 process 64 thread มั้ง เท่าที่ดูจากรูป)
ลองปรับค่าให้น้อยลงจนไม่เกิน RAM

ถ้าเกิดว่ามันเต็มเพราะโดนยิงถล่ม ลองใช้ iptables ตั้งค่า rate limit / connection limit ต่อ IP ดูครับ น่าจะช่วยชีวิต apache ได้

ขออภัยที่ตอบช้า เปิดดูไฟล์ error log แล้วไม่มีอะไรเลยครับ เป็นไปได้ไหมว่า แรมไม่พอจริงๆ หรือ ผมตั้งค่าอะไรผิด มันจึงซดแรมโหดไปหรือเปล่าครับ

เจอแล้วครับ อันนี้ใช่ไหมครับ ควรปรับเป็นเท่าไหร่ดีหรอครับ

เคยเจอ แล้วแก้ปัญหาแบบนี้ครับ เปลี่ยนเป็น fastcgi

cd /usr/local/directadmin/custombuild

nano options.conf

มองหา php1_mode=php-fpm เปลี่ยนเป็น php1_mode=fastcgi

./build php n

service httpd restart


สำหรับ Mysql

nano /etc/my.cnf

เพิ่ม
open_files_limit=8192

service mysqld restart

ขอบคุณครับ เดี๋ยว รอดูมันค้างอีกที แล้วจะเซฟ รูปมาให้ดูกันอีกทีนะครับ คืนนี้กะจะลองเพิ่มแรมดูก่อนด้วยครับ

เจอค้างแล้วครับ เมื่อประมาณ 10.00-11.00น. เป็น 2 รอบครับ

เว็บค้างไปเลย T _ T

บางครั้งซดแรม php-fpm 1-1.5GB ก็จะอืดจะค้างเลยครับ

Apache Error Log ครับ

Sun Jan 17 03:11:07.082423 2016] [auth_digest:notice] [pid 21988:tid 140703224854464] AH01757: generating secret for digest authentication …
[Sun Jan 17 03:11:08.007504 2016] [ssl:warn] [pid 21988:tid 140703224854464] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 17 03:11:08.007770 2016] [lbmethod_heartbeat:notice] [pid 21988:tid 140703224854464] AH02282: No slotmem from mod_heartmonitor
[Sun Jan 17 03:11:08.016852 2016] [mpm_event:notice] [pid 21988:tid 140703224854464] AH00489: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips configured – resuming normal operations
[Sun Jan 17 03:11:08.016933 2016] [core:notice] [pid 21988:tid 140703224854464] AH00094: Command line: ‘/usr/sbin/httpd -D SSL’
[Sun Jan 17 03:56:59.251097 2016] [cgi:error] [pid 25754:tid 140702862198528] [client 115.230.124.164:2047] AH02811: script not found or unable to stat: /var/www/cgi-bin/common
[Sun Jan 17 03:57:47.943395 2016] [cgi:error] [pid 25649:tid 140702704850688] [client 115.230.124.164:1868] AH02811: script not found or unable to stat: /var/www/cgi-bin/common
[Sun Jan 17 06:01:03.243616 2016] [proxy_fcgi:error] [pid 25754:tid 140702956607232] [client 185.130.5.209:59674] AH01071: Got error ‘Primary script unknown

[Sun Jan 17 08:44:18.139891 2016] [cgi:error] [pid 25649:tid 140702967097088] [client 115.230.124.164:2629] AH02811: script not found or unable to stat: /var/www/cgi-bin/common
[Sun Jan 17 10:12:02.847902 2016] [proxy_fcgi:error] [pid 25649:tid 140702998566656] [client 91.196.50.33:37636] AH01071: Got error ‘Primary script unknown

[Sun Jan 17 20:37:07.635259 2016] [proxy_fcgi:error] [pid 2221:tid 140702967097088] [client 179.43.144.14:48622] AH01071: Got error ‘Primary script unknown

[Sun Jan 17 23:05:37.822468 2016] [cgi:error] [pid 2529:tid 140702956607232] [client 115.230.124.164:2077] AH02811: script not found or unable to stat: /var/www/cgi-bin/common
[Mon Jan 18 00:10:05.048989 2016] [core:warn] [pid 21988:tid 140703224854464] AH00045: child process 2529 still did not exit, sending a SIGTERM
[Mon Jan 18 00:10:05.049086 2016] [core:warn] [pid 21988:tid 140703224854464] AH00045: child process 30916 still did not exit, sending a SIGTERM
[Mon Jan 18 00:10:07.051325 2016] [core:warn] [pid 21988:tid 140703224854464] AH00045: child process 2529 still did not exit, sending a SIGTERM
[Mon Jan 18 00:10:07.051393 2016] [core:warn] [pid 21988:tid 140703224854464] AH00045: child process 30916 still did not exit, sending a SIGTERM
[Mon Jan 18 00:10:09.053606 2016] [core:warn] [pid 21988:tid 140703224854464] AH00045: child process 2529 still did not exit, sending a SIGTERM
[Mon Jan 18 00:10:09.053660 2016] [core:warn] [pid 21988:tid 140703224854464] AH00045: child process 30916 still did not exit, sending a SIGTERM
[Mon Jan 18 00:10:11.055867 2016] [core:error] [pid 21988:tid 140703224854464] AH00046: child process 2529 still did not exit, sending a SIGKILL
[Mon Jan 18 00:10:11.055941 2016] [core:error] [pid 21988:tid 140703224854464] AH00046: child process 30916 still did not exit, sending a SIGKILL
[Mon Jan 18 00:10:12.057124 2016] [mpm_event:notice] [pid 21988:tid 140703224854464] AH00494: SIGHUP received. Attempting to restart
[Mon Jan 18 00:10:12.096005 2016] [auth_digest:notice] [pid 21988:tid 140703224854464] AH01757: generating secret for digest authentication …
[Mon Jan 18 00:10:13.006550 2016] [ssl:warn] [pid 21988:tid 140703224854464] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jan 18 00:10:13.006738 2016] [lbmethod_heartbeat:notice] [pid 21988:tid 140703224854464] AH02282: No slotmem from mod_heartmonitor
[Mon Jan 18 00:10:13.013387 2016] [mpm_event:notice] [pid 21988:tid 140703224854464] AH00489: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips configured – resuming normal operations
[Mon Jan 18 00:10:13.013444 2016] [core:notice] [pid 21988:tid 140703224854464] AH00094: Command line: ‘/usr/sbin/httpd -D SSL’
[Mon Jan 18 00:11:09.005168 2016] [ssl:warn] [pid 6825:tid 140262479538112] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jan 18 00:11:09.005471 2016] [suexec:notice] [pid 6825:tid 140262479538112] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jan 18 00:11:09.018203 2016] [auth_digest:notice] [pid 6826:tid 140262479538112] AH01757: generating secret for digest authentication …
[Mon Jan 18 00:11:10.005824 2016] [ssl:warn] [pid 6826:tid 140262479538112] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jan 18 00:11:10.006079 2016] [lbmethod_heartbeat:notice] [pid 6826:tid 140262479538112] AH02282: No slotmem from mod_heartmonitor
[Mon Jan 18 00:11:10.012899 2016] [mpm_event:notice] [pid 6826:tid 140262479538112] AH00489: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips configured – resuming normal operations
[Mon Jan 18 00:11:10.013000 2016] [core:notice] [pid 6826:tid 140262479538112] AH00094: Command line: ‘/usr/sbin/httpd -D SSL’
[Mon Jan 18 08:38:04.607867 2016] [cgi:error] [pid 6845:tid 140261765994240] [client 115.230.124.164:1530] AH02811: script not found or unable to stat: /var/www/cgi-bin/common

[SIZE=4][COLOR=#FF0000]แก้อาการค้างได้แล้วครับ ผม build ใหม่ เอา php-fpm ออกตอนนี้หายค้างเลย [/COLOR]:875328cc::875328cc::875328cc:

ขอขอบคุณทุกท่านที่ช่วยเหลือนะครับ[/SIZE]

ระวัง bug apache ด้วยนะครับ