我在生产环境中运行Debian 7上的MySQL服务器。 我最近(或多或less是偶然的)看看了可以在phpMyAdmin中显示的服务器统计信息。 我看到MySQL服务器通过回答大量的SELECT查询来产生大量的传出stream量。
一些例子:
SELECT语句 你可能会认为这对生产环境来说不算太多。 问题是,这个服务器上使用这个MySQL主机的应用程序还不太stream行,所以它们产生这么多的stream量是不切实际的。
为了找出导致这么多查询的原因,我启用了MySQL服务器的详细日志logging,以及在重新启动服务器1分钟后我看到的是这样的:
Time Id Command Argument 150306 7:14:13 1 Connect debian-sys-maint@localhost on 1 Quit 2 Connect debian-sys-maint@localhost on 2 Quit 3 Connect debian-sys-maint@localhost on mysql 3 Query select @@version_comment limit 1 3 Query show variables like 'datadir' 3 Quit 4 Connect debian-sys-maint@localhost on 4 Query select @@version_comment limit 1 4 Query SELECT count(*) FROM mysql.user WHERE user='root' and password='' 4 Quit 5 Connect debian-sys-maint@localhost on 5 Query select @@version_comment limit 1 5 Query select concat('select count(*) into @discard from `', TABLE_SCHEMA, '`.`', TABLE_NAME, '`') from information_schema.TABLES where ENGINE='MyISAM' 5 Quit 6 Connect debian-sys-maint@localhost on 6 Query select @@version_comment limit 1 6 Query select count(*) into @discard from `information_schema`.`COLUMNS` 6 Quit 7 Connect debian-sys-maint@localhost on 7 Query select @@version_comment limit 1 7 Query select count(*) into @discard from `information_schema`.`EVENTS` 7 Quit 8 Connect debian-sys-maint@localhost on 8 Query select @@version_comment limit 1 8 Query select count(*) into @discard from `information_schema`.`PARAMETERS`
当然还有更多这样的条目。 所以,我确信用户debian-sys-maint正在导致stream量。
有谁可以告诉我为什么这个用户正在做这么多的查询? 我知道这不是一个“正常”的用户,而是一个当然用于维护的系统用户。
如果您需要更多有关环境的信息,请告诉我。