MySQL服务器的CPU使用率没有明显的原因。 任何想法为什么?

我有一个专用于MySQL的服务器。 在深夜,它的CPU使用率没有明显的原因。 这里是图表:

在这里输入图像说明

正如你可以看到CPU利用率刚刚在星期五凌晨3:30发射。 增加的大部分是系统而不是用户。 MySQL服务器根本没有做任何更多的查询。 CPU负载爆炸没有明显的原因。

在星期四下午3:30发生的第一次CPU负载跳转是由于将新代码推送到Web服务器。 该代码在星期四晚上8点恢复到以前的版本,导致CPU负载回落到正常状态。 但是在星期五凌晨三点半发生了一些事情。 没有任何代码更改。 我不知道是什么

你有什么想法可能发生?

编辑

这里是15:30左右的部分/ var / log / cron:

3月3日15:25:01 db crond [8174]:(munin)CMD(/ usr / bin / munin-cron)
3月3日15:25:01 db crond [8175]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月3日15:26:01 db crond [8816]:(root)CMD(/ usr / local / cpanel / whostmgr / bin / dnsqueue> / dev / null 2>&1)
3月3日15:27:01 db crond [8947]:(root)CMD(/ usr / local / sbin / bfd -q)
3月3日15:30:01 db crond [9411] :(根)CMD(/ etc / apf / apf –refresh >> / dev / null 2>&1&)
Mar 3 15:30:01 db crond [9412]:(root)CMD(/ usr / lib64 / sa / sa1 11)
Mar 3 15:30:01 db crond [9413]:(root)CMD(/usr/local/lp/apps/autoupdate/lp-autoupdate.pl> / dev / null 2>&1)
3月3日15:30:01 db crond [9414]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月3日15:30:01 db crond [9415]:(root)CMD(/ usr / local / sbin / bfd -q)
3月3日15:30:01 db crond [9417]:(munin)CMD(/ usr / bin / munin-cron)
3月3日15:33:01 db crond [10502]:(root)CMD(/ usr / local / sbin / bfd -q)
3月3日15:35:01 db crond [10895]:(munin)CMD(/ usr / bin / munin-cron)
3月3日15:35:01 db crond [10896] :(根)CMD(/ usr / bin / test -x / usr / local / cpanel / bin / tail-check && / usr / local / cpanel / bin /检查)
3月3日15:35:01 db crond:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月3日15:36:01 db crond [11494]:(root)CMD(/ usr / local / sbin / bfd -q)
3月3日15:39:01 db crond [12028]:(root)CMD(/ usr / local / sbin / bfd -q)
3月3日15:40:01 db crond [12451]:(root)CMD(/ usr / lib64 / sa / sa1 11)
3月3日15:40:01 db crond [12452] :(根)CMD(/ etc / apf / apf –refresh >> / dev / null 2>&1&)
3月3日15:40:01 db crond [12453]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月3日15:40:01 db crond [12456] 🙁 munin)CMD(/ usr / bin / munin-cron)
3月3日15:41:01 db crond [13384] :(根)CMD(/ usr / local / cpanel / whostmgr / bin / dnsqueue> / dev / null 2>&1)
3月3日15:42:01 db crond [13561]:(root)CMD(/ usr / local / sbin / bfd -q)
3月3日15:45:02 db crond [14266] :(根)CMD(/ usr / local / sbin / bfd -q)
3月3日15:45:02 db crond [14270]:(root)CMD(/usr/local/lp/apps/autoupdate/lp-autoupdate.pl> / dev / null 2>&1)
3月3日15:45:02 db crond [14272] :(根)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月3日15:45:02 db crond [14273] 🙁 munin)CMD(/ usr / bin / munin-cron)
3月3日15:48:01 db crond [15314]:(root)CMD(/ usr / local / sbin / bfd -q)
3月3日15:50:01 db crond [15835]:(munin)CMD(/ usr / bin / munin-cron)
3月3日15:50:01 db crond [15836] :(根)CMD(/ usr / lib64 / sa / sa1 11)
3月3日15:50:01 db crond [15834] :(根)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月3日15:50:02 db crond [15843]:(root)CMD(/ etc / apf / apf –refresh >> / dev / null 2>&1&)
3月3日15:51:01 db crond [16734]:(root)CMD(/ usr / local / sbin / bfd -q)
3月3日15:54:01 db crond [17251] :(根)CMD(/ usr / local / sbin / bfd -q)

这里是星期五3:30的/ var / log / cron的比例:

3月4日03:25:01 db crond [10399]:(munin)CMD(/ usr / bin / munin-cron)
3月4日03:25:01 db crond [10400]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月4日03:26:01 db crond [11056]:(root)CMD(/ usr / local / cpanel / whostmgr / bin / dnsqueue> / dev / null 2>&1)
3月4日03:27:01 db crond [11258] 🙁 mailman)CMD(/ usr / local / cpanel / 3rdparty / bin / python -S / usr / local / cpanel / 3rdparty / mailman / cron / nightly_gzip)
3月4日03:27:01 db crond [11259]:(root)CMD(/ usr / local / sbin / bfd -q)
3月4日03:30:01 db crond [11506]:(root)CMD(/ usr / local / sbin / bfd -q)
Mar 4 03:30:01 db crond [11507] :(根)CMD(/ etc / apf / apf –refresh >> / dev / null 2>&1&)
Mar 4 03:30:01 db crond [11508] :(根)CMD(/ usr / lib64 / sa / sa1 11)
3月4日03:30:01 db crond [11509]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
Mar 4 03:30:01 db crond [11510] 🙁 munin)CMD(/ usr / bin / munin-cron)
3月4日03:30:01 db crond [11515]:(root)CMD(/usr/local/lp/apps/autoupdate/lp-autoupdate.pl> / dev / null 2>&1)
3月4日03:33:01 db crond [12595]:(root)CMD(/ usr / local / sbin / bfd -q)
3月4日03:35:01 db crond [12735]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月4日03:35:01 db crond [12736]:(munin)CMD(/ usr / bin / munin-cron)
3月4日03:35:01 db crond [12737] :(根)CMD(/ usr / bin / test -x / usr / local / cpanel / bin / tail-check && / usr / local / cpanel / bin /检查)
3月4日03:36:01 db crond [13355] :(根)CMD(/ usr / local / sbin / bfd -q)
3月4日03:39:01 db crond [13822]:(root)CMD(/ usr / local / sbin / bfd -q)
3月4日03:40:01 db crond [13975]:(root)CMD(/ etc / apf / apf –refresh >> / dev / null 2>&1&)
3月4日03:40:01 db crond [13976]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月4日03:40:01 db crond [13977]:(root)CMD(/ usr / lib64 / sa / sa1 11)
3月4日03:40:01 db crond [13978]:(munin)CMD(/ usr / bin / munin-cron)
3月4日03:41:01 db crond [14796]:(root)CMD(/ usr / local / cpanel / whostmgr / bin / dnsqueue> / dev / null 2>&1)
3月4日03:42:02 db crond [15068]:(root)CMD(/ usr / local / sbin / bfd -q)
3月4日03:45:01 db crond [15441]:(root)CMD(/ usr / local / sbin / bfd -q)
3月4日03:45:01 db crond [15443] :(根)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
Mar 4 03:45:01 db crond [15442] 🙁 munin)CMD(/ usr / bin / munin-cron)
Mar 4 03:45:01 db crond [15444] :(根)CMD(/usr/local/lp/apps/autoupdate/lp-autoupdate.pl> / dev / null 2>&1)
3月4日03:48:01 db crond [16499]:(root)CMD(/ usr / local / sbin / bfd -q)
Mar 4 03:50:01 db crond [16705] :(根)CMD(/ usr / lib64 / sa / sa1 11)
3月4日03:50:01 db crond [16706]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)
3月4日03:50:01 db crond [16707]:(root)CMD(/ etc / apf / apf –refresh >> / dev / null 2>&1&)
3月4日03:50:01 db crond [16708] 🙁 munin)CMD(/ usr / bin / munin-cron)
3月4日03:51:01 db crond [17574]:(root)CMD(/ usr / local / sbin / bfd -q)
3月4日03:54:01 db crond [18086] :(根)CMD(/ usr / local / sbin / bfd -q)
3月4日03:55:01 db crond [18222]:(root)CMD(/ usr / local / cpanel / bin / dcpumon> / dev / null 2>&1)

有任何想法吗?

如果这是一个cron作业,cron作业完成后CPU负载不应该回落。 CPU负载一直居高不下,其中大部分被MySQL使用。 这是top的输出:

 top - 13:51:49 up 22 days, 21:35, 1 user, load average: 17.10, 17.67, 17.67 Tasks: 432 total, 1 running, 431 sleeping, 0 stopped, 0 zombie Cpu(s): 14.5%us, 49.2%sy, 0.0%ni, 36.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8177596k total, 6886860k used, 1290736k free, 545776k buffers Swap: 4096564k total, 0k used, 4096564k free, 5264320k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1200 mysql 15 0 2258m 341m 4352 S 2036.1 4.3 1658:23 mysqld 4269 root 15 0 13008 1364 808 R 0.7 0.0 0:00.39 top 4636 root 10 -5 0 0 0 S 0.3 0.0 13:22.79 kjournald 1 root 15 0 10352 704 588 S 0.0 0.0 0:07.19 init 

这个MySQL服务器是否pipe理面向公众的网站的数据库?

有时半夜CPU峰值可能与索引大量页面的search引擎机器人相关。 检查您的Web服务器上的访问日志/分析是否匹配。

没有更多的信息,不,我不知道可能发生了什么。 在指定的范围内CPU使用率明显上升,但我不知道你的系统可能会做什么:syslog将是我开始看的第一个地方。 相隔十二个小时重新出现的峰值使我怀疑正常的cron任务,可能是备份或重新索引。 如果您可以提供更多的上下文,我很乐意帮助您深入了解这一点。

cron的任务也是我的第一个想法。

检查你的日志,看看里面是否有任何东西(syslog或cron)。 另外,如果您使用默认的cron结构,请检查您的cron.daily文件夹以查找最近可能已由新软件包安装的新脚本。

编辑:也检查您的备份脚本或日志,看看他们是否有困难的时间完成或访问系统上的文件。

如果mysqld导致你的CPU不稳定,你可能需要检查SHOW PROCESSLIST;的输出SHOW PROCESSLIST;

我也会检查一下mysql日志,看看发生什么事情时发生了什么。