MYSQL 备份工具
backup of a database is a very important thing. If no backup, meet the following situation goes crazy:
UPDATE or DELETE whitout where…
table was DROPPed accidentally…
INNODB was corrupt…
entire datacenter loses power…
Data from the safety point of view, the server disk will do raid, MySQL itself also has a master-slave, DRBD disaster recovery mechanism, but they are not completely replace the backup. Fault tolerance and high availability can help us deal with physical, hardware, machinery, and logic errors on our committed but incapable of action. The probability of each logical errors are very low, but when the various possibilities of superposition, the small probability event is enlarged into a great safety hidden trouble, this time need backup highlights. So in many ways the MySQL backup, which is suitable for us?
Backup common
MySQL itself provides us with mysqldump, mysqlbinlog remote backup tool, Percona also provides powerful Xtrabackup for us, With the open source mydumper, And based on the master-slave synchronization delay from the library backup, cold standby mode, And based on the file system snapshot backup, In fact, the choice has much to see things in a blur. While the backup is in order to recover, so that we can backup mode after a failure occurs rapidly, accurately and recovery, is the most suitable for us, of course, also can save money, save trouble, it is perfect. Several backup tools here I understand some comparison, discuss their applicable scene.
1. mysqldump & mydumper
Mysqldump is a logical backup method is the most simple. When the backup MyISAM table, if you want to obtain consistent data, you need to lock table, simple and rude. And when the backup InnoDB table, With – master-data=1 – the single-transaction option, Beginning in the transaction, Record binlog POS, Then use mvcc to obtain consistent data, Because it is a long transaction, In the write and update of large quantity of database, Will have a lot of undo, Significant performance impact, It should be used with caution.

- Advantages: simple, for single table backup, especially useful when the total amount of export structure.
- Disadvantages: simple and crude, single threaded, backup and recovery slow slow, span of IDC are likely to encounter the time zone.
Mydumper is an enhanced version of the mysqldump. Compared with mysqldump: - Built-in support for compression, can save storage space of 2-4 times.
- Parallel backup and recovery, so a lot faster than mysqldump, but because it is a logical backup, still not very fast.
2 the snapshot file system based on
The snapshot based on file system, is a physical backup. In the backup before the need for some complex settings, in the backup time get the snapshot and record binlog POS, then the copy-on-write like mode, the snapshot dump. Dump the snapshot itself will consume some IO resources, but also in the writing case pressure, save the changes to the data block before the impression will consume IO, finally showed a decline in the overall performance of the. And the server and copy-on-write snapshots allow more disk space, which in itself is a waste of resources. This backup methods we use no more.

3. Xtrabackup
This is probably the most widely backup mode. Percona is make known to every family, Xtrabackup should not. It is actually the combination of physical backup, logical backup. When the backup InnoDB table, it copies the IBD file, and change constantly monitors the redo log, append to their transaction log files. In the process of copying IBD files, IBD files may be written "flower", this is not a problem, because the first prepare stage in the copy after the completion of the Xtrabackup, by a similar method to the InnoDB crash recovery, to restore data files and log files consistent state, and the transaction is rolled back the uncommitted. If at the same time the need to backup MyISAM and file InnoDB table structure, then need to use the flush tables with lock to obtain the global lock, began to copy these files no longer changes, at the same time to obtain binlog location, copy after release the lock, and stop the redo log monitor.
It works as follows:

Because MySQL is inevitably contains the MyISAM table, At the same time, innobackup is not a backup file table structure, So you want to backup the MySQL instance, Will not have to execute flush tables with read lock, This statement will be any query (including select) obstruction, During a jam, It in turn blocking any query (including select). If you happen to back up the instance is executed before flush tables with read lock query, database hang. When flush tables with read lock to obtain the global lock, although the query can be executed, but still blocking update, so, we hope that flush tables with read lock from the beginning to the end, the duration of the shorter the better.
In order to solve this problem, two methods are effective:
1 as far as possible without MyISAM table.
2 Xtrabackup increase – Rsync options, to reduce holdings of global locking time by two Rsync.
The backup process optimized as follows:

- Advantages: online hot backup, all increased by + + flow speed, support, support compression, encryption is supported.
- Disadvantages: the need to obtain a global lock, if meet the query, the waiting time is not controllable, so to do a good job monitoring, kill the long queries or Dutch act when necessary; encountered large examples, the backup process is longer, redo log is the effect of the recovery rate, in this case the best delay backup.
4. mysqlbinlog 5.6
All the above backup, only to recover the database to a point in time the backup: mysqldump and mydumper, and snapshot is a backup starting time; Xtrabackup is the backup end point in time. In order to realize the point in time recovery, must also backup binlog. At the same time, binlog is also the precious resources increased by.
Fortunately, MySQL 5.6 offers binlog remote backup options:
mysqlbinlog --raw --read-from-remote-server --stop-never
It will be disguised as a MySQL from the database, obtaining binlog from a remote and then dump. This is not on the line capacity cannot save more binlog scene is very useful. However, it is after all not a true MySQL from the database instance, state monitoring and synchronization requires a separate deployment. So personally think that using Blackhole to backup the full amount of binlog is the better choice. The author has implemented an automated build Blackhole from the database tools, slightly modified, can perfect build Blackhole from the library. Once the basic synchronous up, put things right once and for all, little problems, when the switch with cut on the line.
Prompt:
- Don't underestimate binlog backup. When 5.6 of the multithreading replication large-scale use, from the library after the main library command point of time will be greatly reduced, so we put every day a full backup to once every 3 days, and weekly full backup, incremental backup and persistent binlog. When a failure to recover the data, reproducing 3, 5 days binlog is extremely fast. Reduce the benefits of backup frequency is the most direct, save money, save trouble.
- Blackhole is excellent for backup binlog. On the one hand can be used to recover the database backup binlog for a long time, on the other hand, in the semi synchronous replication, which can effectively prevent the main library binlog is missing.
Summary
Each has its own merits. backup mode, and to us, in the face of thousands of examples, select the appropriate backup tool to achieve unified configuration, unified planning, construction of backup cloud platform of intelligent scheduling is the kingly way. After all, cost of operation and maintenance of coexistence of multiple backup modes can not be ignored.
From experience, with Xtrabackup full data, preparation of binlog by Blackhole enrichment, and regularly on the effectiveness of the backup data to verify, is the good choice.
MYSQL 备份工具的更多相关文章
- MySQL备份工具之mysqldump使用
MySQL备份工具之mysqldump使用说明 一.备份分类 根据能否停用数据库,将备份类型分为: 1. 冷备:数据库服务停止后备份 2. 温备:只能对数据库进行读操作,不能进行写操作 3. 热备:在 ...
- mysql备份工具innobackupex,xtrabackup-2.1的原理和安装
mysql备份工具innobackupex,xtrabackup-2.1的原理和安装 http://bbs.2cto.com/read.php?tid=310496 一.Xtrabackup介绍 1. ...
- Mysql备份工具xtraback全量和增量测试
Mysql备份工具xtraback全量和增量测试 xtrabackup 是 percona 的一个开源项目,可以热备份innodb ,XtraDB,和MyISAM(会锁表) 官方网址http:// ...
- Mysql备份工具比较
Mysql备份工具比较 大 | 中 | 小 [ 2012/12/25 12:10 | by Sonic ] 1. 使用automysqlbackup http://sourceforge.net/pr ...
- shell编写mysql备份工具
如需转载,请经本人同意. 这是之前写的一个备份脚本,调用的备份工具是xtrabackup 编写思路是:每周一全备份,备份后提取lSN号,对备份文件进行压缩,其余时候在LSN的基础上进行增量备份,并对3 ...
- mysql备份工具 :mysqldump mydumper Xtrabackup 原理
备份是数据安全的最后一道防线,对于任何数据丢失的场景,备份虽然不一定能恢复百分之百的数据(取决于备份周期),但至少能将损失降到最低.衡量备份恢复有两个重要的指标:恢复点目标(RPO)和恢复时间目标(R ...
- Mysql备份工具mysqldump和mysqlhotcopy
(1).Mysql备份类型 1)按照备份时对数据库的影响分为 Hot backup(热备):也叫在线备份.指在数据库运行中直接备份,对正在运行的数据库没有任何影响. Cold backup(冷备):也 ...
- mysql二进制日志和mysql备份工具介绍以及日志恢复
mysql备份: 三种备份方式 冷备:数据库停机,在进行备份 热备:lock table锁表,read 数据库只可以读不能写,在备份 温备:备份时数据库正常运行 备份类型:完整备份:全部备份,部分 ...
- Mysql备份工具Xtrabackup
Xtrabackup是一个开源的免费的热备工具,在Xtrabackup包中主要有Xtrabackup和innobackupex两个工具.其中Xtrabackup只能备份InnoDB和XtraDB两种引 ...
- MySQL备份工具percona-xtrabackup安装
1.安装xtrabackup的yum源 rpm -ivh https://www.percona.com/redir/downloads/percona-release/redhat/latest/p ...
随机推荐
- T-SQL 数据库笔试题
1.说明:创建数据库 Create DATABASE database-name 2.说明:删除数据库 drop database dbname 3.说明:备份sql server --- 创建备份数 ...
- cocos2d-x 详解之 CCTexture2D(纹理图片)和 CCTextureCache(纹理缓存)
精灵和动画都涉及到纹理图片的使用,所以在研究精灵与动画之前,我们先来了解一下纹理图片类CCTexture2D和纹理缓存CCTextureCache的原理: 当一张图片被加载到内存后,它是以纹理的形式存 ...
- ckeditor+jsp+spring配置图片上传
CKEditor用于富文本输入是极好的,它还有一些插件支持扩展功能,其中图片上传就是比较常用到的.本文简单记录我的实现步骤. 1.CKEditor除了提供三种标准版压缩包下载,还可根据自己的需求进行个 ...
- Getting Started(Google Cloud Storage Client Library)
在运行下面的步骤之前,请确保: 1.你的项目已经激活了Google Cloud Storage和App Engine,包括已经创建了至少一个Cloud Storage bucket. 2.你已经下载了 ...
- CSS布局基础
(初级)css布局 一.单列布局1.基础知识块级元素 div p ul li dl dt 行级元素 img span input strong同一行显示.无换行2.盒子模型盒子模型 (边框border ...
- MongoVUE 如何导出数据
1.MongoVUE导出数据 正常连接如数据后,打开对应数据库的collections,然后点击右上角的“Refresh”的下拉小三角,打开export 根据个人喜好,或业务需求,选择导出的格式 最后 ...
- 有趣的Node爬虫,数据导出成Excel
最近一直没更新了诶,因为学习Backbone好头痛,别问我为什么不继续AngularJs~因为2.0要出来了啊,妈蛋!好,言归正传,最近帮我的好基友扒数据,他说要一些股票债券的数据.我一听,那不就是要 ...
- HDU1973 http://acm.hdu.edu.cn/showproblem.php?pid=1973
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<queue> #inc ...
- 你应该知道的16个Linux服务器监控命令
在不同的Linux发行版中,会有不同的GUI程序可以显示各种系统信息,比如SUSE Linux发行版中,就有非常棒的图形化的配置和管理工具YaST,KDE桌面环境里的KDE System Guard也 ...
- 159. Longest Substring with At Most Two Distinct Characters
最后更新 二刷 08-Jan-17 回头看了下一刷的,用的map,应该是int[256]的意思,后面没仔细看cuz whatever I was doing at that time.. wasnt ...