20151229
主题:The BINARY LOG
(来自MySQL reference manual 5.2.4)
=============================================
A BINARY LOG FILE may become larger THAN max_binlog_size IF you are USING large transactions because a TRANSACTION IS written TO the FILE IN ONE piece, never split BETWEEN files。
reset master 语句会删除所有binlog;purge binary logs删除部分binlog,所以在复制环境中慎用该命令;
一条语句或者事务在释放锁或提交之前在结束之后,会立即记录binlog,以保证日志是按提交顺序记录的。
binlog_cache_use状态变量记录使用buffer或者临时表来缓存语句的事务数,binlog_cache_disk_use记录的是必须用到临时文件的事务数,这两个值可以用来调整binlog_cache_size大小的一个参考;
分类排序输出
mysqlbinlog /path/to/mysql-bin.000999 | \
grep -i -e "^update" -e "^insert" -e "^delete" -e "^replace" -e "^alter" | \
cut -c1-100 | tr '[A-Z]' '[a-z]' | \
sed -e "s/\t/ /g;s/\`//g;s/(.*$//;s/ set .*$//;s/ as .*$//" | sed -e "s/ where .*$//" | \
sort | uniq -c | sort -nr
阅读(869) | 评论(0) | 转发(0) |