深圳全飞鸿

标题: 优化mysql slave的同步速度 [打印本页]

作者: zhgc    时间: 2020-4-6 21:25
标题: 优化mysql slave的同步速度

两个参数会影响速度
mysql> set global sync_binlog=20 ;
Query OK, 0 rows affected (0.00 sec)
mysql> set global innodb_flush_log_at_trx_commit=2;
Query OK, 0 rows affected (0.00 sec)

innodb_flush_log_at_trx_commit默认为1.   调为0后,速度提升很明显
由于没有用到binlog, 所有还没有测试sync_binlog。而且sync_binlog数据默认已经是0了

# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=0








欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2