宝塔51特惠活动,企业版1099元/年,送SSL证书,最高立减2万元!查看活动
当前位置:论坛首页 > Linux面板 > 求助

【已解答】CPU占用过高的问题

发表在 Linux面板2023-4-11 19:29 [复制链接] 1 2676

用的Linode的一核 1G的最低配置VPS

装的mysql5.6

以前装2-3个wordpress网站都没有问题,

最近这个vps只装了一个网站,不过配了woocommerce,

结果连续2天收到主机的警告,说cpu达到98%,然后登陆一看,mysql也自动停止了,

这是mysql慢日志,请部一下是什么原因。谢谢。

/www/server/mysql/bin/mysqld, Version: 5.6.50-log (Source distribution). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/www/server/mysql/bin/mysqld, Version: 5.6.50-log (Source distribution). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/www/server/mysql/bin/mysqld, Version: 5.6.50-log (Source distribution). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/www/server/mysql/bin/mysqld, Version: 5.6.50-log (Source distribution). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/www/server/mysql/bin/mysqld, Version: 5.6.50-log (Source distribution). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/www/server/mysql/bin/mysqld, Version: 5.6.50-log (Source distribution). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument

这是日志:

  1. 2023-04-10 12:12:11 7997 [Note] InnoDB: Database was not shutdown normally!
  2. 2023-04-10 12:12:11 7997 [Note] InnoDB: Starting crash recovery.
  3. 2023-04-10 12:12:11 7997 [Note] InnoDB: Reading tablespace information from the .ibd files...
  4. 2023-04-10 12:12:11 7997 [Note] InnoDB: Restoring possible half-written data pages
  5. 2023-04-10 12:12:11 7997 [Note] InnoDB: from the doublewrite buffer...
  6. InnoDB: Last MySQL binlog file position 0 13753006, file name mysql-bin.000007
  7. 2023-04-10 12:12:11 7997 [Note] InnoDB: 128 rollback segment(s) are active.
  8. 2023-04-10 12:12:11 7997 [Note] InnoDB: Waiting for purge to start
  9. 2023-04-10 12:12:11 7997 [Note] InnoDB: 5.6.50 started; log sequence number 29984848
  10. 2023-04-10 12:12:11 7997 [Note] Recovering after a crash using mysql-bin
  11. 2023-04-10 12:12:11 7997 [Note] Starting crash recovery...
  12. 2023-04-10 12:12:11 7997 [Note] Crash recovery finished.
  13. 2023-04-10 12:12:11 7997 [Note] RSA private key file not found: /www/server/data//private_key.pem. Some authentication plugins will not work.
  14. 2023-04-10 12:12:11 7997 [Note] RSA public key file not found: /www/server/data//public_key.pem. Some authentication plugins will not work.
  15. 2023-04-10 12:12:11 7997 [Note] Server hostname (bind-address): '*'; port: 3306
  16. 2023-04-10 12:12:11 7997 [Note] IPv6 is available.
  17. 2023-04-10 12:12:11 7997 [Note]   - '::' resolves to '::';
  18. 2023-04-10 12:12:11 7997 [Note] Server socket created on IP: '::'.
  19. 2023-04-10 12:12:11 7997 [Note] Event Scheduler: Loaded 0 events
  20. 2023-04-10 12:12:11 7997 [Note] /www/server/mysql/bin/mysqld: ready for connections.
  21. Version: '5.6.50-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
复制代码



使用道具 举报 只看该作者 回复
发表于 2023-4-11 21:00:28 | 显示全部楼层
您好,Linux系统的CPU满载通常是由以下原因引起的:
1、运行大量的进程或线程:如果系统中同时运行了大量的进程或线程,会导致CPU负载的增加。可以使用命令如top、htop等来查看系统中运行的进程和它们的CPU占用情况,以找出造成CPU满载的进程。
2、运行占用CPU资源较高的应用程序:如果系统中运行的应用程序占用了大量的CPU资源,也会导致CPU满载。可以使用命令如ps、top等来查看运行的应用程序和它们的CPU占用情况,以找出造成CPU满载的应用程序。
3、系统负载过高:如果系统负载过高,也会导致CPU满载。系统负载是指当前正在运行或等待运行的进程数,可以使用命令uptime来查看系统负载情况。如果系统负载过高,可以考虑增加系统资源或者优化系统配置。

如果查询到是mysql、php、nginx这些应用占用了复制,建议排查网站日志,看看是不是被打了,或者mysql,php是否有大量慢日志,有的话联系程序员给您处理一下;
如果您不会分析网站日志的话,软件商店有【网站监控报表插件】,可视化查看日志,查看当前有哪些网站请求、访问异常的,如果有大量请求在1秒或几秒内进来,大概率就是被打了导致的,您可以尝试以下方法解决
1、安装我们的【nginx防火墙】插件拦截攻击
2、.打开nginx防火墙,查看是否存在被攻击的记录,尝试将nginx防火墙的cc防御规则调整为增强模式,看cpu是否降下来了
详细设置参考cc防御那一段:https://www.bt.cn/bbs/thread-73847-1-1.html
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术免费分析
快速回复 返回顶部 返回列表