Automation Script For Percona Xtrabackup FULL/Incremental
This is my first post in 2019, and Im starting with a MySQL solution. In MySQL world, implementing a better backup strategy to meet all of your requirement is still a challenging thing. The complexity depends on your RPO and RTO. Percona has many tools to help DBAs in many scenarios. Xtrabackup is one of the best backup tools to perform a better backup on TeraBytes size of databases. Also, another great feature is it supports Incremental and Differential backup.
There are couple of tools which is available in MySQL world, But due to some restrictions we can’t achieve what we are expecting.
#1 mysqldump
This is a widely used backup tool and most of the DBAs are trust this. This comes with the mysql package. Initially, it was a single thread process but now we have multi-thread in native mysqldump. Its completely a logical backup tool. It has a wide range of parameters to use while taking backups (like include routines, events, triggers).
Right place to use mysqldump
Use if your databases are less than 20GB. Because the restore process will take more time. This will affect your RTO.
Advantages:
- Easy to use
- More detailed documentation.
- Multi-Thread (we need to add parameters to perform this)
- Comes with MySQL, so they will fix if any bugs and implementing new features.
Drawbacks:
- Backup is multi-thread, but not restore. Its still a single thread process.
- No incremental backup feature.
- Restoration takes more time for large backups.
#2 mydumper/myloader
This is an opensource tool and DBAs are using this for dump the huge databases. It has inbuild multi-thread dump and restore feature. This is the pioneer for mysql’s multi thread dump. It supports snapshot consistency. So it’ll provide the accurate binlog file and its position.
The right place to use mydumper/myloader
If you have the databases grater then 20GB to TB/PB. I have used this to dump TB size. If you used this to take dump for a PB size DB using mysqldumper then please comment below
Advantages:
- Multi-thread backup and restore.
- Supports for Incremental backups.
- Log the binlog info, so we can easily built a new slave.
- We can control the number of threads.
- Compression support.
- Include/Exclude tables in backup.
- Split the table into chunks.
- And etc,etc.
Drawbacks:
- This is also a logical dump. So it needs to scan the complete tables.
- Performance degrade during the backup.
- No checksum.
#3 Percona Xtrabackup:
This is my favourite opensource tool from Percona. This is also supports incremental backup. The main reason is its very fast since its logical backup. Instead of reading my story just go through this Doc link and see its features.
You can use this to backup >20GB databases to TB or PB.
Advantages:
- Multi-thread
- Super fast
- Compression
- Checksum
- Encryption
- Master/Slave binlog info.
- Directly restore the backups to AWS Aurora.
Drawback:
- Not much, I’ll update this section if I found something
Shell Script to Automate Xtrabackup:
Now coming to the automation part. Im using a shell script to automate FULL and Incremental backup also sync them with GCS and S3. This script is already written by bigzaqui at 2013. But I replaced innobackupex with Xtrabackup and few more changes.
Parameters needs to change:
-u sqladmin– Mysql user to take the dump. Replace with-u your_userSECRET='mysql-user-password'– Mysql user’s password.--history– Im tacking backup activity into a database. If you don’t want to track just remove this.--slave-info– If you are taking the backup from a slave, it’ll capture the master’s binlog info. So you can setup a new replica for the Master Server. You can remove this if you are not using slave to take backup.--compress-threads=4,---parallel=4The number of threads needs to perform compress. Its a best practice to allocate 30%-40% from the total cores. I have 40core cpu, so I used 15 threads.--remove-original– While decompressing a compressed backup, it’ll leave the compressed files. So this will remove compressed files after the extraction process.BACKUP_DIR=/mysqldump/xtrabackup/– Location for saving the dump.DATA_DIR=/mysqldata– Location of mysql data directory. If you added[xtrabackup]parameters inmy.cnffile, then no need to mention this.
Run this script:
- FULL Backup –
./xtrabackup_full_increment_restore.sh full - Incremental Backup –
./xtrabackup_full_increment_restore.sh incremental - Restore –
./xtrabackup_full_increment_restore.sh restore
Automation Script For Percona Xtrabackup FULL/Incremental的更多相关文章
- Percona XtraBackup 核心文档
1. 介绍 1.1 MySQL 备份工具特性对比 Features Percona XtraBackup MySQL Enterprise backup License GPL Proprietary ...
- (转)CentOS 7 下 MySQL 5.7 配置 Percona Xtrabackup
CentOS 7 下 MySQL 5.7 配置 Percona Xtrabackup 原文:http://qizhanming.com/blog/2017/05/10/install-percona- ...
- Percona XtraBackup User Manual 阅读笔记
XtraBackup XtraBackup 2 安装XtraBackup 2.1 安装XtraBackup binary版本 2.1.1 yum的安装方法: 2.1.2 直接下载rpm包安装 3 Xt ...
- MariaDB之基于Percona Xtrabackup备份大数据库[完整备份与增量备份]
MariaDB之基于Percona Xtrabackup备份大数据库[完整备份与增量备份] 1.Xtrabackup的安装 percona-xtrabackup-2.2.3-4982.el6.x86_ ...
- Percona Xtrabackup备份mysql(转)
add by zhj:另外,参考了Xtrabackup之innobackupex备份恢复详解,我用的是Xtrabackup2.2.6版本, 可以成功备份和恢复指定的数据库. 原文:http://www ...
- Percona Xtrabackup备份mysql全库及指定数据库(完整备份与增量备份)
原文地址:http://www.tuicool.com/articles/RZRnq2 Xtrabackup简介 Percona XtraBackup是开源免费的MySQL数据库热备份软件,它能对In ...
- 通过Percona Xtrabackup实现数据的备份与恢复
Xtrabackup简介 Percona XtraBackup是一个开源.免费的MySQL热备份软件,能够为InnoDB和XtraDB数据库执行非阻塞备份,特点如下: 1.快速.可靠的完成备份 2.备 ...
- Percona XtraBackup 关于 MySQL备份还原的详细测试
一. Percona XtraBackup 的优点. (1)无需停止数据库进行InnoDB热备: (2)增量备份MySQL: (3)流压缩传输到其它服务器: (4)在线移动表: (5)能够比较容易地创 ...
- Percona XtraBackup使用说明(转)
Percona XtraBackup使用说明 转载出自: https://blog.csdn.net/wfs1994/article/details/80396604 XtraBackup介绍 Per ...
随机推荐
- Spring Security和JWT实现登录授权认证
目标 1.Token鉴权 2.Restful API 3.Spring Security+JWT 开始 自行新建Spring Boot工程 引入相关依赖 <dependency> < ...
- 工厂模式——java设计模式
工厂模式 目录 何为工厂模式 工厂方法与抽象工厂 如何在Java EE中通过@Producers与@Inject注解实现工厂模式 如何创建自定义注解以及通过@Qualifier消除具体实现之间的歧义 ...
- SSO - 开篇引例
进公司以来, 所做的产品中, 下面的子系统就没有少于10个的, 其中有的是.net做的, 有的是java做的, 还有安卓端, ios端. 那么这么多子系统, 我可能需要访问其中的多个(同一平台), 我 ...
- WPF 中动态改变控件模板
在某些项目中,可能需要动态的改变控件的模板,例如软件中可以选择不同的主题,在不同的主题下软件界面.控件的样式都会有所不同,这时即可通过改变控件模板的方式实现期望的功能. 基本方法是当用户点击切换主题按 ...
- layer插件学习——icon样式
本文是自己整理的关于layer插件的icon样式结果 一.准备工作 下载jQuery插件和layer插件,并引入插件(注意:jQuery插件必须在layer插件之前引用) 百度云资源链接: jQuer ...
- Deep learning with Python 学习笔记(2)
本节介绍基于Keras的CNN 卷积神经网络接收形状为 (image_height, image_width, image_channels)的输入张量(不包括批量维度),宽度和高度两个维度的尺寸通常 ...
- es6学习笔记11--Proxy和Reflect
Proxy概述 Proxy用于修改某些操作的默认行为,等同于在语言层面做出修改,所以属于一种“元编程”(meta programming),即对编程语言进行编程. Proxy可以理解成,在目标对象之前 ...
- 【转】CSS3 Box-sizing
box-sizing是CSS3的box属性之一.一说到CSS的盒模型(Box model)我想很多人都会比较烦,特别是对于新手,然而这个Box model又是我们CSS运用中比较重要的一个属性.那么C ...
- 并发编程——详解 AQS CLH 锁
从 acquire 方法开始 -- 获取 为什么 AQS 需要一个虚拟 head 节点 reelase 方法如何释放锁 总结 前言 AQS 是 JUC 中的核心,其中封装了资源的获取和释放,在我们之前 ...
- C#中利用LightningChart绘制曲线图表
最近在做一个“基于C#语言的电炉温控制软件设计”的设计,我在大学并不是专业学习C#语言编程的,对C#的学习研究完全是处于兴趣,所以编程技术也不是很厉害,遇到问题多参照网络上的开源码. 这不,在做这个课 ...