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. mysql-unsha1:在未知密码情况下,登录任意MYSQL数据库

    摘要 这个POC用于在不知道明文密码的情况下对启用了密码安全认证插件(默认开启插件:mysql_native_password)的MYSQL数据库进行登录. 前提条件为: 1.为了获取到已知用户的ha ...

  2. Redis安装以及主从实现

    Redis简介 redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串). list(链表).set(集合)和zset(有序 ...

  3. spring boot整合双持久层框架jpa、mybatis

    公司之前用的是spring boot + jpa,但由于jpa无法完美的解决某些动态查询问题,就使用的jdbcTemplate 动态封装SQL,由于代码相对复杂,可读性差,现准备再引入mybatis. ...

  4. 浅析Java源码之HttpServlet

    纯粹是闲的,在慕课网看了几集的Servlet入门,刚写了1个小demo,就想看看源码,好在也不难 主要是介绍一下里面的主要方法,真的没什么内容啊~ 源码来源于apache-tomcat-7.0.52, ...

  5. (译) 在AngularJS中使用的表单验证功能【转】

    验证功能是AngularJS里面最酷炫的功能之一,它可以让你写出一个具有良好用户体验的Web应用. 在AngularJS中,有许多用于验证的指令.我们将先学习几个最流行的内置指令,然后再创建一个自定义 ...

  6. arm裸板驱动总结(makefile+lds链接脚本+裸板调试)

    在裸板2440中,当我们使用nand启动时,2440会自动将前4k字节复制到内部sram中,如下图所示: 然而此时的SDRAM.nandflash的控制时序等都还没初始化,所以我们就只能使用前0~40 ...

  7. Linux-man命令(17)

    man命令是Linux下的帮助指令,通过man指令可以查看Linux中的指令帮助.配置文件帮助和编程帮助等信息 可以按章节来搜索手册: man 1: 用户命令(ls,cd,cp,rm,tar等) ma ...

  8. TCP Socket Http关系

    理解Tomcat内部处理网络数据的机制同时需要了解相关的一些术语,这样我们在阅读源码的时候能更加清楚的理解Connector下使用到的Socket通信原理. TCP/IP: 数据在网络传输是基于TCP ...

  9. Tunnel Warfare(hdu1540 线段树)

    Tunnel Warfare Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) T ...

  10. Software-Defined Networking A Comprehensive Survey --阅读_day1

    The Internet has led to the creation of a digital society, where (almost) everything is connected an ...