binlog旋转时,mysql查询变得非常慢
Mysql版本是5.7.13。binlog旋转时,mysql查询变得非常慢,mysql,mysqlbinlog,Mysql,Mysqlbinlog,Mysql版本是5.7.13。 每次binlog文件旋转时,所有查询和dml都会变得非常慢。 服务器“冻结”约40秒。 在慢速查询日志中,我只看到提交和系统/会话变量查询(如select@@session.tx_read_only;)大约需要20秒 ==================主服务器我的.cnf===================== [mysqld] # Remove leading # and set to the amount of RAM for the most impor
每次binlog文件旋转时,所有查询和dml都会变得非常慢。
服务器“冻结”约40秒。
在慢速查询日志中,我只看到提交和系统/会话变量查询(如select@@session.tx_read_only;)大约需要20秒 ==================主服务器我的.cnf===================== [mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
innodb_buffer_pool_size = 2048M
innodb_log_file_size = 360M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 2
innodb_max_dirty_pages_pct = 50
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
log-bin=/alidata1/binlog/mysql-bin
expire_logs_days=7
binlog-do-db=mydb
sync_binlog=6
server_id=10
slow_query_log=on
slow_query_log_file=/data/slow_query/slow_query.log
log_queries_not_using_indexes=off
long_query_time=1
wait_timeout=10800
max_connections=800
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#character_set_server=utf8
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
===========================binlog文件=========================
# User@Host: user[user] @ [10.24.165.8] Id: 130132
# Query_time: 14.186255 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1499749959;
select @@session.tx_read_only;
# User@Host: user[user] @ [10.25.208.208] Id: 130317
# Query_time: 13.943930 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1499749959;
select @@session.tx_read_only;
# User@Host: user[user] @ [10.24.165.8] Id: 130204
# Query_time: 13.848498 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1499749959;
select @@session.tx_read_only;
# User@Host: user[user] @ [10.24.165.8] Id: 130197
# Query_time: 12.988434 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1499749959;
select @@session.tx_read_only;
===================mysql慢速日志==========================
# User@Host: user[user] @ [10.24.165.8] Id: 130132
# Query_time: 14.186255 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1499749959;
select @@session.tx_read_only;
# User@Host: user[user] @ [10.25.208.208] Id: 130317
# Query_time: 13.943930 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1499749959;
select @@session.tx_read_only;
# User@Host: user[user] @ [10.24.165.8] Id: 130204
# Query_time: 13.848498 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1499749959;
select @@session.tx_read_only;
# User@Host: user[user] @ [10.24.165.8] Id: 130197
# Query_time: 12.988434 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1499749959;
select @@session.tx_read_only;