请帮帮我。由于CPU使用率很高,我的服务器无法访问。 mysqld占用了所有的CPU。 show processlist;在大多数情况下不显示任何疑问。我在3天内尝试了一切,但问题仍然存在。 请注意,如果我停止apache mysqld cpu使用率变低
服务器是具有两个3Ghz核心的VPS& 8GB RAM
my.cnf conf :(我尝试了几种不同的设置,但没有任何帮助)
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
syslog
[mysqld]
myisam_use_mmap=1
query_cache_type = 1
join_buffer_size=1M
read_rnd_buffer_size=1M
tmp_table_size=25M
max_heap_table_size=25M
table_open_cache = 7500
open_files_limit=30000
key_buffer_size = 800M
myisam_sort_buffer_size = 256M
innodb_file_per_table=1
innodb_buffer_pool_size = 2G
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 25
myisam-recover = BACKUP
max_connections = 500
query_cache_limit = 2M
query_cache_size = 75M
general-log-file = /var/log/mysql/mysql.log
general-log = 1
log_error = /var/log/mysql/error.log
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2
expire_logs_days = 10
max_binlog_size = 100M
[mysqldump]
quick
quote-names
max_allowed_packet = 10M
[mysql]
#no-auto-rehash
[isamchk]
key_buffer = 16M
!includedir /etc/mysql/conf.d/
在问题开始之前我在mysql error.log中看到几个表崩溃了......我修复了&优化它们但问题仍然存在。 今天早上服务器正常工作15分钟,但CPU又恢复了100%..我怀疑黑客攻击但是apache访问日志只显示了几次root登录尝试
编辑 iostat输出:
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
vda 269.25 2533.24 65.85 236529 6148
vdb 3.56 15.46 0.00 1443 0
vdc 1.81 7.24 0.00 676 0