Why MySQL replication is better than mysqlbinlog for recovery
来源:互联网 发布:js原型继承面试题 编辑:程序博客网 时间:2024/06/05 18:50
本文转载自: http://www.xaprb.com/blog/2010/09/04/why-mysql-replication-is-better-than-mysqlbinlog-for-recovery/
You have a backup, and you have the binary logs between that backup and now. You need to do point-in-time recovery (PITR) for some reason. What do you do? The traditional answer is “restore the backup and then use mysqlbinlog to apply the binary logs.” But there’s a much better way to do it.
The better way is to set up a server instance with no data, and load the binary logs into it. I call this a “binlog server.” Then restore your backup and start the server as a replication slave of the binlog server. Let the roll-forward of the binlogs happen through replication, not through the mysqlbinlog tool.
Why is this better? Because replication is a more tested way of applying binary logs to a server. The results are much more likely to be correct, in my opinion. Plus, replication is easier and more convenient to use. You can do nice things like START SLAVE UNTIL, skip statements, stop and restart without having to figure out where you left off, and so on.
Replication also has the ability to correctly reproduce more types of changes than mysqlbinlog does. Try this with statement-based replication:
insert into tbl(col) values(connection_id());
That’ll work just fine through replication, because the SQL thread on the slave will change its connection ID to match the original. It won’t work through mysqlbinlog.
Posted on Sat, Sep 4, 2010. Approximately 300 Words.
注:近期参加MySQL运维学习,老师推荐该文章作为学习和技术提高的扩展阅读,先记录到自己的博客中,随后慢慢消化、学习、提高。本文章与“日志系统”主题相关。
- Why MySQL replication is better than mysqlbinlog for recovery
- Why Git is Better than X
- Why Git is Better than X
- Why Git is better than SVN
- Why is ARKit better than the alternatives?
- why not better than her for English?
- Why character array is better than String for Storing password in Java
- 7 Reasons Why BSD Is Better than Linux
- Why SAP HANA is a Better Choice than Oracle Exalytics
- Why is Oracle OCI a better API for a scalable, multi-threaded application than Open Database Connectivity (ODBC) ?
- Why Google better than baidu
- Why is the Asynchronous mode is better than the Synchronous one when handling clients requests?
- Why ConcurrentHashMap is better than Hashtable and just as good as a HashMap
- Functional is better than function
- Today is Better than yesterday
- Line is better than words
- NOW IS BETTER THAN NEVER!
- Two is better than one
- opera, chrome调试wap网站
- sqlite3 --sql命令简单介绍
- PyGObject笔记1——用Python写图形界面
- MyEclipse中删除添加的Hibernate Capabilities
- 《从程序员到项目经理》读后感-金子何时发光
- Why MySQL replication is better than mysqlbinlog for recovery
- [综合面试] 面试70问 经典回答
- 各推
- jquery focus在click等事件中失效
- java synchronized修饰方法和修饰方法块
- Android预定义样式
- 设计模式之代理模式 (三)
- SAP Gateway FAQ
- string和stringstream用法总结