![需要确定我的 VPS 为何每隔几天就会重新启动,突然出现峰值](https://linux22.com/image/672752/%E9%9C%80%E8%A6%81%E7%A1%AE%E5%AE%9A%E6%88%91%E7%9A%84%20VPS%20%E4%B8%BA%E4%BD%95%E6%AF%8F%E9%9A%94%E5%87%A0%E5%A4%A9%E5%B0%B1%E4%BC%9A%E9%87%8D%E6%96%B0%E5%90%AF%E5%8A%A8%EF%BC%8C%E7%AA%81%E7%84%B6%E5%87%BA%E7%8E%B0%E5%B3%B0%E5%80%BC.png)
有人能解释一下为什么我的 LAMP VPS 服务器(运行 centos)每隔几天就会重启吗?
嗯,我知道为什么 - 这是因为 CPU 和负载突然飙升,但是什么导致了飙升,我该怎么办?
我每分钟记录一次统计数据,峰值的分钟报告如下:
top - 12:13:02 up 1 day, 2:54, 0 users, load average: 54.35, 14.70, 5.17
Tasks: 263 total, 59 running, 203 sleeping, 0 stopped, 1 zombie
Cpu(s): 7.3%us, 1.0%sy, 0.2%ni, 91.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8388608k total, 6851460k used, 1537148k free, 0k buffers
Swap: 4194304k total, 788260k used, 3406044k free, 4106336k cached
其中有很多(大约 50 个):
23488 ealteach 20 0 186m 46m 36m R 4.1 0.6 0:01.35 php
23556 ealteach 20 0 186m 42m 32m R 4.1 0.5 0:01.17 php
23557 ealteach 20 0 187m 46m 36m R 4.1 0.6 0:01.31 php
23563 ealteach 20 0 185m 40m 30m R 4.1 0.5 0:01.06 php
23580 ealteach 20 0 186m 46m 35m R 4.1 0.6 0:01.37 php
还有这些(大约 50 个):
951 nobody 20 0 80304 5756 3120 S 0.0 0.1 0:00.44 httpd
960 nobody 20 0 78828 4208 3052 S 0.0 0.1 0:00.36 httpd
961 nobody 20 0 79724 5048 3120 S 0.0 0.1 0:00.39 httpd
964 nobody 20 0 78936 4312 3116 S 0.0 0.1 0:00.38 httpd
976 nobody 20 0 78936 4284 3120 S 0.0 0.1 0:00.37 httpd
netstat 报告了这些内容的负载(50 个或更多):
tcp 0 0 23.88.105.45:443 141.101.105.221:27034 ESTABLISHED 23535/httpd
tcp 0 0 23.88.105.45:443 141.101.105.221:56499 ESTABLISHED 23460/httpd
tcp 0 0 23.88.105.45:443 141.101.105.221:51605 ESTABLISHED 23520/httpd
tcp 0 0 23.88.105.45:443 141.101.105.221:23056 ESTABLISHED 11663/httpd
tcp 0 0 23.88.105.45:443 141.101.105.221:29759 ESTABLISHED 19770/httpd
还有一堆(50 个或更多):
unix 3 [ ] STREAM CONNECTED 1571882093 1038/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 1571882087 23563/php
unix 3 [ ] STREAM CONNECTED 1571879605 1038/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 1571879602 23567/php
unix 3 [ ] STREAM CONNECTED 1571876258 1038/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 1571876253 23570/php
MySQL 报告了以下这些内容:
| 14477 | ealteach_main | localhost | ealteach_main | Sleep | 26 | | | 0.000 |
| 14478 | ealteach_main | localhost | ealteach_main | Sleep | 27 | | | 0.000 |
| 14487 | ealteach_main | localhost | ealteach_main | Sleep | 23 | | | 0.000 |
| 14489 | ealteach_main | localhost | ealteach_main | Sleep | 24 | | | 0.000 |
| 14493 | ealteach_main | localhost | ealteach_main | Sleep | 25 | | | 0.000 |
有人可以帮忙吗?