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_user
  • SECRET='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=4 The 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 in my.cnf file, 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的更多相关文章

  1. Percona XtraBackup 核心文档

    1. 介绍 1.1 MySQL 备份工具特性对比 Features Percona XtraBackup MySQL Enterprise backup License GPL Proprietary ...

  2. (转)CentOS 7 下 MySQL 5.7 配置 Percona Xtrabackup

    CentOS 7 下 MySQL 5.7 配置 Percona Xtrabackup 原文:http://qizhanming.com/blog/2017/05/10/install-percona- ...

  3. Percona XtraBackup User Manual 阅读笔记

    XtraBackup XtraBackup 2 安装XtraBackup 2.1 安装XtraBackup binary版本 2.1.1 yum的安装方法: 2.1.2 直接下载rpm包安装 3 Xt ...

  4. MariaDB之基于Percona Xtrabackup备份大数据库[完整备份与增量备份]

    MariaDB之基于Percona Xtrabackup备份大数据库[完整备份与增量备份] 1.Xtrabackup的安装 percona-xtrabackup-2.2.3-4982.el6.x86_ ...

  5. Percona Xtrabackup备份mysql(转)

    add by zhj:另外,参考了Xtrabackup之innobackupex备份恢复详解,我用的是Xtrabackup2.2.6版本, 可以成功备份和恢复指定的数据库. 原文:http://www ...

  6. Percona Xtrabackup备份mysql全库及指定数据库(完整备份与增量备份)

    原文地址:http://www.tuicool.com/articles/RZRnq2 Xtrabackup简介 Percona XtraBackup是开源免费的MySQL数据库热备份软件,它能对In ...

  7. 通过Percona Xtrabackup实现数据的备份与恢复

    Xtrabackup简介 Percona XtraBackup是一个开源.免费的MySQL热备份软件,能够为InnoDB和XtraDB数据库执行非阻塞备份,特点如下: 1.快速.可靠的完成备份 2.备 ...

  8. Percona XtraBackup 关于 MySQL备份还原的详细测试

    一. Percona XtraBackup 的优点. (1)无需停止数据库进行InnoDB热备: (2)增量备份MySQL: (3)流压缩传输到其它服务器: (4)在线移动表: (5)能够比较容易地创 ...

  9. Percona XtraBackup使用说明(转)

    Percona XtraBackup使用说明 转载出自: https://blog.csdn.net/wfs1994/article/details/80396604 XtraBackup介绍 Per ...

随机推荐

  1. 详解C#特性和反射(三)

    类型信息(Type Information)用来表示类型声明的信息,通过抽象基类System.Type的实例存储这些信息,当使用反射时,CLR获取指定类型的Type对象,通过这个对象即可访问该类型的任 ...

  2. CRM项目hellokitty部分交互界面

    登录界面 实现密码的不显示,验证码的跟换 员工管理界面  完成所有的功能 学校统计界面 完成所有的功能 班级管理 差一个手风琴组件 其他功能也完成了

  3. Eclipse 处理 Console 打印信息自动删除

    开发中,特识是需要项目运行打印日志很长的时候需要查看打印的日志, Eclipse没经过设定的话,会自动80000行之前的日志记录. 想要日志一直打印下去处理方法: Preferences --> ...

  4. 统计频率(map映照容器的使用)

    问题描述  AOA非常喜欢阅读莎士比亚的诗,莎士比亚的诗中有种无形的魅力吸引着他!他认为莎士比亚的诗中之所以些的如此传神,应该是他的构词非常好!所以AOA想知道,在莎士比亚的书中,每个单词出现的频率各 ...

  5. T4模板根据数据库表和列的Description生成代码的summary的终极解决方案

    相信很多人都用T4模版生成代码,用T4模版生成标准代码真的很方便.我们经常根据表生成相关的代码, 但是估计很多人都遇见过同一个问题, 特别是我们在生成model的时候,代码中model中的Summar ...

  6. WPF备忘录(3)如何从 Datagrid 中获得单元格的内容与 使用值转换器进行绑定数据的转换IValueConverter

    一.如何从 Datagrid 中获得单元格的内容 DataGrid 属于一种 ItemsControl, 因此,它有 Items 属性并且用ItemContainer 封装它的 items. 但是,W ...

  7. sqlserver清除缓存(转载)

    sqlserver清除缓存,记录查询时间   1 2 3 4 5 6 7 8 9 10 11 12 --1. 将当前数据库的全部脏页写入磁盘.“脏页”是已输入缓存区高速缓存且已修改但尚未写入磁盘的数据 ...

  8. Spring IOC 容器源码分析

    声明!非原创,本文出处 Spring 最重要的概念是 IOC 和 AOP,本篇文章其实就是要带领大家来分析下 Spring 的 IOC 容器.既然大家平时都要用到 Spring,怎么可以不好好了解 S ...

  9. JAVA设计模式详解(六)----------状态模式

    各位朋友,本次LZ分享的是状态模式,在这之前,恳请LZ解释一下,由于最近公司事情多,比较忙,所以导致更新速度稍微慢了些(哦,往后LZ会越来越忙=.=). 状态模式,又称状态对象模式(Pattern o ...

  10. 【 js 基础 】【 源码学习 】柯里化和箭头函数

    最近在看 redux 的源码,代码结构很简单,主要就是6个文件,其中 index.js 负责将剩余5个文件中定义的方法 export 出来,其他5个文件各自负责一个方法的实现. 大部分代码比较简单,很 ...