我们为 wordpress 网站新安装的 VPS 服务器,mysql 进程的 CPU 使用率很高,一直高达 50%。我们的访客不多,终止进程也不起作用,另一个新的 mysql 进程的 CPU 使用率很高。
流程:
43361 (Trace) (Kill) mysql 0 49.49 3.38 /usr/sbin/mariadbd
踪迹:
strace: Process 43361 attached
restart_syscall(<... resuming interrupted poll ...>) = 1
accept4(25, {sa_family=AF_UNIX}, [128 => 2], SOCK_CLOEXEC) = 69
futex(0x55f1f596c328, FUTEX_WAKE_PRIVATE, 1) = 1
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}], 3, -1) = 1 ([{fd=25, revents=POLLIN}])
accept4(25, {sa_family=AF_UNIX}, [128 => 2], SOCK_CLOEXEC) = 17
futex(0x55f1f596c328, FUTEX_WAKE_PRIVATE, 1) = 1
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}], 3, -1) = 1 ([{fd=25, revents=POLLIN}])
accept4(25, {sa_family=AF_UNIX}, [128 => 2], SOCK_CLOEXEC) = 76
futex(0x55f1f596c328, FUTEX_WAKE_PRIVATE, 1) = 1
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}], 3, -1) = 1 ([{fd=25, revents=POLLIN}])
accept4(25, {sa_family=AF_UNIX}, [128 => 2], SOCK_CLOEXEC) = 17
futex(0x55f1f596c32c, FUTEX_WAKE_PRIVATE, 1) = 1
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
accept4(25, 0x7ffef08641a0, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}], 3, -1) = 1 ([{fd=25, revents=POLLIN}])
accept4(25, {sa_family=AF_UNIX}, [128 => 2], SOCK_CLOEXEC) = 69
futex(0x55f1f596c32c, FUTEX_WAKE_PRIVATE, 1) = 1
...
我该怎么做才能阻止这种情况?请帮忙。
谢谢!
答案1
请检查您的数据库服务器是否可公开访问(mysql 端口 3306)。因此,如果您没有禁用用户注册和匿名评论帖子,则可能对数据库服务器本身进行暴力攻击,也可能对 WP 网站进行攻击。
此外,根据 VPS 提供商的不同,您可能已经达到 CPU 信用限制,因此您的 vps 速度会降低,这实际上表明 CPU 使用率很高。