错误日志
二进制日志
作用:数据恢复、主从复制
配置:
- server_id
- log_bin
- binlog_format
- expires_logs_days
- sync_binlog=1/0
双一说明?
innodb_flush_log_at_trx_commit=1 每次日志提交,必然log buffer中redo落到磁盘
sync_binlog=1 每次日志提交,必然保证binlog cache中的日志落到磁盘
涉及重点命令:
show master status; # 看当前使用的binlogshow binlog event in 'mysql-bin.000001'; # 事件查看mysql -e 'how binlog event in 'mysql-bin.000001;'|grep 'DROP' # 过滤mysqlbinlog --start-position --stop-position mysql-bin.000002 # 无GTIDmysqlbinlog -d zabbix --start-position --stop-position mysql-bin.000002 # 无GTIDmysqlbinlog --start-datetime --stop-endtime mysql-bin.000002mysqlbinlog --skip-gtids --include-gtids='xxxxxxxxxxx:7-11' mysql-bin.000002 mysql-bin.000003set sql_log_bin=0; 临时关闭bin-logsource /tmp/bin.logset sql_log_bin=1;>flush logs # 滚动日志purge binary logs to ...reset master # 全部删除,主从必崩
