我目前正在将 joomla 网站从共享主机移动到专用主机。
我面临的问题是页面加载缓慢,我认为这与 mysql 有关。我告诉你是因为有时(从昨天开始 3 次 :S)mysql 守护进程会关闭,我必须将其重新联机(登录 /var/log/mysql/ 不会报告任何内容。不知道为什么)。
我打开了慢查询日志并报告了以下情况:
/usr/sbin/mysqld, Version: 5.5.35-0+wheezy1-log ((Debian)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 140213 15:42:22
# User@Host: debian-sys-maint[debian-sys-maint] @ localhost []
# Query_time: 5.542592 Lock_time: 0.000729 Rows_sent: 0 Rows_examined: 643
SET timestamp=1392302542;
select count(*) into @discard from `information_schema`.`PARTITIONS`;
/usr/sbin/mysqld, Version: 5.5.35-0+wheezy1-log ((Debian)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 140213 15:46:52
# User@Host: debian-sys-maint[debian-sys-maint] @ localhost []
# Query_time: 3.404442 Lock_time: 0.000656 Rows_sent: 0 Rows_examined: 643
SET timestamp=1392302812;
select count(*) into @discard from `information_schema`.`PARTITIONS`;
/usr/sbin/mysqld, Version: 5.5.35-0+wheezy1-log ((Debian)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 140213 15:53:23
# User@Host: kool2B[kool2B] @ localhost []
# Query_time: 3.020636 Lock_time: 0.000340 Rows_sent: 5 Rows_examined: 4868
use kool2Bdb;
SET timestamp=1392303203;
SELECT i.id, i.catid, i.alias, i.modified, i.publish_down, c.alias AS categoryalias , c.name AS categoryname, i.title, i.introtext, i.fulltext
FROM w0nmk_k2_items AS i
INNER JOIN w0nmk_k2_categories c ON c.id = i.catid
INNER JOIN w0nmk_k2_tags_xref tr ON tr.itemID = i.id
AND tr.tagID IN (SELECT tagID FROM w0nmk_k2_tags_xref WHERE itemID = '5199')
WHERE i.published = 1 AND c.published = 1
AND (i.publish_down > CURDATE() OR i.publish_down = '0000-00-00 00:00:00')
AND i.id <> 5199 AND i.catid IN(149,150,151,152,153,154,155,156,159,160,161,163,164,167,165,138,139,142,143,213)
GROUP BY i.id
LIMIT 0, 5;
# Time: 140213 15:56:34
# User@Host: kool2B[kool2B] @ localhost []
# Query_time: 3.612114 Lock_time: 0.000392 Rows_sent: 5 Rows_examined: 5865
SET timestamp=1392303394;
SELECT i.id, i.catid, i.alias, i.modified, i.publish_down, c.alias AS categoryalias , c.name AS categoryname, i.title, i.introtext, i.fulltext
FROM w0nmk_k2_items AS i
INNER JOIN w0nmk_k2_categories c ON c.id = i.catid
INNER JOIN w0nmk_k2_tags_xref tr ON tr.itemID = i.id
AND tr.tagID IN (SELECT tagID FROM w0nmk_k2_tags_xref WHERE itemID = '5275')
WHERE i.published = 1 AND c.published = 1
AND (i.publish_down > CURDATE() OR i.publish_down = '0000-00-00 00:00:00')
AND i.id <> 5275 AND i.catid IN(149,150,151,152,153,154,155,156,159,160,161,163,164,167,165,138,139,142,143,213)
GROUP BY i.id
LIMIT 0, 5;
您认为该服务器出现这个时间是正常的吗?
Atom 1.6 GHz+,配备 2 GB RAM
这是my.cnf文件:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
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 = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
expire_logs_days = 10
max_binlog_size = 100M
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
希望有人能帮我解决这个问题。谢谢。
答案1
好吧,我终于发现 joomla 中安装了一个存在安全问题的组件,黑客利用它杀死了 Apache。所以 mysql 没有任何问题。
我在查看 Apache 日志时发现了这个问题。好吧,不管怎样,还是谢谢你!
问候