502错误 该改的都改了还出现
debian系统,,按照置顶的帖子改了,不行,按照
这个文章:http://www.kuqin.com/web/20120220/318312.html
改了还不行
我的日志文件 /usr/local/php/logs/php-fpm.log内容如下:Jun 13 19:18:08.343374 fpm_got_signal(), line 56: received SIGTERM
Jun 13 19:18:08.343428 fpm_pctl(), line 256: switching to 'terminating' state
Jun 13 19:18:08.343464 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4767 (pool default)
Jun 13 19:18:08.343483 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4765 (pool default)
Jun 13 19:18:08.343498 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4763 (pool default)
Jun 13 19:18:08.343512 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4762 (pool default)
Jun 13 19:18:08.343529 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4761 (pool default)
Jun 13 19:18:08.343540 fpm_pctl_kill_all(), line 181: 5 children are still alive
Jun 13 19:18:08.345361 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:18:08.345424 fpm_children_bury(), line 215: child 4762 (pool default) exited on signal 15 SIGTERM after 480.795660 seconds from start
Jun 13 19:18:08.345878 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:18:08.345932 fpm_children_bury(), line 215: child 4761 (pool default) exited on signal 15 SIGTERM after 480.798342 seconds from start
Jun 13 19:18:08.345962 fpm_children_bury(), line 215: child 4767 (pool default) exited on signal 15 SIGTERM after 480.789034 seconds from start
Jun 13 19:18:08.346025 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:18:08.346077 fpm_children_bury(), line 215: child 4763 (pool default) exited on signal 15 SIGTERM after 480.793935 seconds from start
Jun 13 19:18:08.347985 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:18:08.348027 fpm_children_bury(), line 215: child 4765 (pool default) exited on signal 15 SIGTERM after 480.793417 seconds from start
Jun 13 19:18:08.348055 fpm_pctl_exit(), line 81: exiting, bye-bye!
Jun 13 19:18:09.405286 fpm_unix_init_main(), line 284: getrlimit(nofile): max:1024, cur:1024
Jun 13 19:18:09.405686 fpm_event_init_main(), line 88: libevent: using epoll
Jun 13 19:18:09.405759 fpm_init(), line 52: fpm is running, pid 11894
Jun 13 19:18:09.408197 fpm_children_make(), line 352: child 11895 (pool default) started
Jun 13 19:18:09.410643 fpm_children_make(), line 352: child 11896 (pool default) started
Jun 13 19:18:09.413004 fpm_children_make(), line 352: child 11897 (pool default) started
Jun 13 19:18:09.415279 fpm_children_make(), line 352: child 11899 (pool default) started
Jun 13 19:18:09.417430 fpm_children_make(), line 352: child 11900 (pool default) started
Jun 13 19:18:09.417488 fpm_event_loop(), line 107: libevent: entering main loop
Jun 13 19:41:07.397826 fpm_got_signal(), line 56: received SIGTERM
Jun 13 19:41:07.397887 fpm_pctl(), line 256: switching to 'terminating' state
Jun 13 19:41:07.397917 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11900 (pool default)
Jun 13 19:41:07.397935 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11899 (pool default)
Jun 13 19:41:07.397953 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11897 (pool default)
Jun 13 19:41:07.397975 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11896 (pool default)
Jun 13 19:41:07.397996 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11895 (pool default)
Jun 13 19:41:07.398009 fpm_pctl_kill_all(), line 181: 5 children are still alive
Jun 13 19:41:07.400293 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:41:07.400375 fpm_children_bury(), line 215: child 11895 (pool default) exited on signal 15 SIGTERM after 1377.992318 seconds from start
Jun 13 19:41:07.400426 fpm_children_bury(), line 215: child 11896 (pool default) exited on signal 15 SIGTERM after 1377.989853 seconds from start
Jun 13 19:41:07.400473 fpm_children_bury(), line 215: child 11897 (pool default) exited on signal 15 SIGTERM after 1377.987541 seconds from start
Jun 13 19:41:07.400510 fpm_children_bury(), line 215: child 11900 (pool default) exited on signal 15 SIGTERM after 1377.983145 seconds from start
Jun 13 19:41:07.400539 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:41:07.400550 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:41:07.400563 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:41:07.402180 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:41:07.402241 fpm_children_bury(), line 215: child 11899 (pool default) exited on signal 15 SIGTERM after 1377.987029 seconds from start
Jun 13 19:41:07.402257 fpm_pctl_exit(), line 81: exiting, bye-bye!
Jun 13 19:41:38.730735 fpm_unix_init_main(), line 284: getrlimit(nofile): max:4096, cur:1024
Jun 13 19:41:38.732919 fpm_event_init_main(), line 88: libevent: using epoll
Jun 13 19:41:38.733152 fpm_init(), line 52: fpm is running, pid 1795
Jun 13 19:41:38.735363 fpm_children_make(), line 352: child 1796 (pool default) started
Jun 13 19:41:38.737322 fpm_children_make(), line 352: child 1797 (pool default) started
Jun 13 19:41:38.739549 fpm_children_make(), line 352: child 1798 (pool default) started
Jun 13 19:41:38.741747 fpm_children_make(), line 352: child 1799 (pool default) started
Jun 13 19:41:38.743998 fpm_children_make(), line 352: child 1801 (pool default) started
Jun 13 19:41:38.744085 fpm_event_loop(), line 107: libevent: entering main loop
Jun 13 19:48:22.833659 fpm_got_signal(), line 56: received SIGTERM
Jun 13 19:48:22.833716 fpm_pctl(), line 256: switching to 'terminating' state
Jun 13 19:48:22.833750 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1801 (pool default)
Jun 13 19:48:22.833767 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1799 (pool default)
Jun 13 19:48:22.833790 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1798 (pool default)
Jun 13 19:48:22.833812 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1797 (pool default)
Jun 13 19:48:22.833833 fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1796 (pool default)
Jun 13 19:48:22.833846 fpm_pctl_kill_all(), line 181: 5 children are still alive
Jun 13 19:48:22.835233 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:48:22.835310 fpm_children_bury(), line 215: child 1801 (pool default) exited on signal 15 SIGTERM after 403.813830 seconds from start
Jun 13 19:48:22.835599 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:48:22.835667 fpm_children_bury(), line 215: child 1797 (pool default) exited on signal 15 SIGTERM after 403.820855 seconds from start
Jun 13 19:48:22.835737 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:48:22.835782 fpm_children_bury(), line 215: child 1799 (pool default) exited on signal 15 SIGTERM after 403.816553 seconds from start
Jun 13 19:48:22.836005 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:48:22.836048 fpm_children_bury(), line 215: child 1798 (pool default) exited on signal 15 SIGTERM after 403.819034 seconds from start
Jun 13 19:48:22.837688 fpm_got_signal(), line 48: received SIGCHLD
Jun 13 19:48:22.837750 fpm_children_bury(), line 215: child 1796 (pool default) exited on signal 15 SIGTERM after 403.824943 seconds from start
Jun 13 19:48:22.837768 fpm_pctl_exit(), line 81: exiting, bye-bye!
Jun 13 19:49:07.708442 fpm_unix_init_main(), line 284: getrlimit(nofile): max:4096, cur:1024
Jun 13 19:49:07.726680 fpm_event_init_main(), line 88: libevent: using epoll
Jun 13 19:49:07.727023 fpm_init(), line 52: fpm is running, pid 1819
Jun 13 19:49:07.728761 fpm_children_make(), line 352: child 1820 (pool default) started
Jun 13 19:49:07.730547 fpm_children_make(), line 352: child 1821 (pool default) started
Jun 13 19:49:07.732509 fpm_children_make(), line 352: child 1822 (pool default) started
Jun 13 19:49:07.734281 fpm_children_make(), line 352: child 1823 (pool default) started
Jun 13 19:49:07.736230 fpm_children_make(), line 352: child 1825 (pool default) started
Jun 13 19:49:07.736288 fpm_event_loop(), line 107: libevent: entering main looptop内容如下:
PID USER PRNIVIRTRESSHR S %CPU %MEM TIME+COMMAND
1825 www 20 0 2603210m 5208 R1002.116:29.41 php-cgi
1820 www 20 0 2679211m 5204 R 832.215:02.53 php-cgi
1821 www 20 0 24772 9.8m 5552 R 782.015:35.50 php-cgi
1823 www 20 0 24960 9516 5148 S 461.914:33.31 php-cgi
1822 www 20 0 2685211m 5160 R 442.315:06.76 php-cgi
1765 root 20 0 46924772512 S 00.2 0:00.05 memcached
CPU利用太高了。。。高手帮忙解决一下。。。谢谢了。
系统平均负载3.75 3.37 2.43 4/85
运行了几个纯php程序是不是太资源了??
[ 本帖最后由 sofeng 于 2012-6-14 13:49 编辑 ] 置顶帖502排查里的https://bbs.vpser.net/thread-1654-1-1.html 试试 改了改 希望可以加了个重启脚本,,希望可以对大家有帮助。
LNMP-502自动重启脚本
使用lnmp的同学经常会遇到nginx出现502的情况,有些时候无论怎么调整,都不能解决问题,如果在睡觉的时候出现问题,而自己又没有检查,那流量不就白白浪费了吗?
下面我介绍一种方法,完全可以监测到502然后自动重启php-fpm
在SSH中新建一个文件
SSH中输入:
vi 502.sh
在文件中输入如下内容
#!/usr/bin/php
<?
$url = 'https://www.vpser.net';
$cmd = '/usr/local/php/sbin/php-fpm restart';
for($i = 0; $i < 5; $i ++){
$exec = "curl --connect-timeout 3 -I $url 2>/dev/null";
$res = shell_exec($exec);
if(stripos($res,'502 Bad Gateway') !== false){
shell_exec($cmd);
exit();
}
}
?>
然后保存,其中的网址设置你这台VPS上的任意网页
赋予777权限
chmod 777 /root/502.sh
下一步我们设置上定时
crontab使用方法
SSH中输入crontab -e
输入:
*/1 * * * * /root/502.sh
这样就可以自动检测网页如果是502 就自动重启 http://www.xobm.com/linux/detail/id-347.html
页:
[1]