Create an instant backup of a MySQL database manually

Create an instant backup of a MySQL database manuallyΒΆ

After you create a backup schedule as described in Enable a backup schedule for a MySQL database, you may also need to create an instant backup of a MySQL database.

To create an instant backup manually:

  1. Log in to the MySQL database master node. For example, dbs01.

  2. Run the following script:

    /usr/local/bin/innobackupex-runner.sh
    
  3. Verify that a complete backup has been created on the MySQL database master node:

    ls /var/backups/mysql/xtrabackup/full
    

    If you rerun /usr/local/bin/innobackupex-runner.sh, it creates an incremental backup for the previous complete backup in /var/backups/mysql/xtrabackup/incr.

    You can pass the following flags with the innobackupex-runner.sh script:

    • -s makes the script to skip the cleanup. It can be useful if you want to trigger a manual backup keeping all the previous backups. Be aware that once you run the script without the -s flag or if an automatic backup is triggered, the backups will be cleaned and only the defined number of the latest backups will be kept.
    • -f forces the script to run the full backup instead of an incremental one.
    • -c forces the script to run only the cleanup.
  4. Verify that the complete backup has been rsynced to the xtrabackup server node from the Salt Master node:

    salt -C 'I@xtrabackup:server' cmd.run 'ls /var/backups/mysql/xtrabackup/full'
    

    Note

    If you run /usr/local/bin/innobackupex-runner.sh more than once, at least one incremental backup is created in /var/backups/mysql/xtrabackup/incr on the node.