首页 > 数据库 > MySQL > mysqlbinlog 恢复、备份
--read-from-remote-server 从host:port实例读取binlog, u/p必须指定# 从 mysql-bin.000003 开始(含)
--to-last-log 从某个binlog文件开始(含)直到最后,配合 --read-from-remote-server 使用
mysqlbinlog -h/P/u/p/d --read-from-remote-server mysql-bin.000001
mysqlbinlog -h/P/u/p/d --read-from-remote-server --to-last-log mysql-bin.000003# sqlfile里的表已经指定了库名
--read-from-remote-server 配套参数 -h/P/u/p user需要 "REPLICATION SLAVE" 权限# 可选参数
--raw
--to-last-log 从某个binlog开始
--stop-never 实时备份,直到master宕机。默认启用 --to-last-log 配置
原理:默认连接master使用的server_id=0,但--stop-never使用的server_id=65535(可通过 --stop-never-slave-server-id 配置)获取完binlog后,如果server_id>0,则一直等待新的binlog event,否则退出
--stop-never-slave-server-id 连接master时使用的server id。配合 --stop-server使用
--result-file=rvalue 默认是当前目录,binlog名称与master相同
rvalue可以是字符串也可以是目录,最终都是作为原binlog的前缀若原binlog为mysql-binlog.*** ,则保存为rvaluemysql-binlog.***
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26250550/viewspace-1840586/ ,如需转载,请注明出处,否则将追究法律责任。