二进制日志需要掌握的内容

时间:2021-02-03 10:37:19   收藏:0   阅读:0

二进制日志:

1先确认正在用的是哪个日志:

show master status;

2查看当前日志文件的事件:

show binlog events in ‘mysql-bin.000003‘;

3通过位置号截取二进制日志:

mysqlbinlog --start-position --stop-position

4如果有gtid,更推荐于下面用法:

mysqlbinlog --skip-gtids --include-gtids --exclude-gtids

--skip-gtids:不检查gtid的密等性

--indude-gtids:截取日志的范围

--execlude-gtids:排除掉那些不想截取的日志

5二进制日志恢复注意事项:

1)set sql_log_bin=0:临时关闭二进制记录

2)使用source命令恢复脚本

6掌握慢日志分析工具pt-query-digest

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!