Difference between revisions of "Xtrabackup"

From ArchWiki
Jump to: navigation, search
Line 5: Line 5:
 
It can back up data from InnoDB, XtraDB, and MyISAM tables on MySQL 5.0 and 5.1 servers, and it has many advanced features like partial, remote, compressed and incremental backups, multi-threaded file copying for performance and Point-in-time recovery.
 
It can back up data from InnoDB, XtraDB, and MyISAM tables on MySQL 5.0 and 5.1 servers, and it has many advanced features like partial, remote, compressed and incremental backups, multi-threaded file copying for performance and Point-in-time recovery.
 
{{Note| MyISAM tables are read-only while they are being backed up.}}
 
{{Note| MyISAM tables are read-only while they are being backed up.}}
 +
 +
==Instalation==
 +
- Install the [https://aur.archlinux.org/packages/xtrabackup xtrabackup] package from AUR.
 +
{{Note| If you are using a [[AUR helper]], like [[yaourt]], this will do the work:
 +
# yaourt -Sy xtrabackup
 +
}}
 +
 +
==Usage Examples==
 +
XtraBackup is really a set of three tools:
 +
* xtrabackup - a compiled C binary, which copies only InnoDB and XtraDB data
 +
* innobackupex - a wrapper script that provides functionality to backup a whole MySQL database instance with MyISAM, InnoDB, and XtraDB tables.
 +
* tar4ibd - tars InnoDB data safely.
 +
 +
In all of the below examples, the following is assumed:
 +
 +
* You are backing up a server whose data is stored in /var/lib/mysql/, which is the standard location for Archlinux
 +
* You are storing the backups in /data/backups/mysql
 +
* You have a my.cnf file in a standard location, such as /etc/my.cnf, with at least the following contents:
 +
[mysqld]
 +
datadir=/var/lib/mysql/
 +
[xtrabackup]
 +
target_dir=/data/backups/mysql/
 +
 +
===xtrabackup===
 +
Making the backup copies the InnoDB data and log files to the destination. Preparing the backup makes the data files consistent and ready to use.
 +
 +
* Make a backup:
 +
# xtrabackup --backup
 +
Prepare the backup:
 +
# xtrabackup --prepare
 +
Prepare again, to create fresh InnoDB log files:
 +
# xtrabackup --prepare
 +
 +
The exit status of a successful xtrabackup is 0. In the second --prepare step, you should see InnoDB print messages similar to “Log file ./ib_logfile0 did not exist: new to be created”, followed by a line indicating the log file was created.
 +
Relevant Configuration
 +
 +
You might want to set the --use-memory option to something similar to the size of your buffer pool, if you are on a dedicated server that has enough free memory. The complete documentation of the tool is [http://www.percona.com/docs/wiki/percona-xtrabackup:xtrabackup:start here].

Revision as of 23:03, 28 March 2011

Percona XtraBackup is an high performance, low-profile and non-blocking open-source backup utility for InnoDB and XtraDB databases.

Currently is the only open-source tool that performs backups on 'MySQL-based' servers (MySQL, MariaDB, Percona Server) that doesn't lock your database during it. Backups are online, and queries and transactions continue to run without interruption ('hot backups').

It can back up data from InnoDB, XtraDB, and MyISAM tables on MySQL 5.0 and 5.1 servers, and it has many advanced features like partial, remote, compressed and incremental backups, multi-threaded file copying for performance and Point-in-time recovery.

Note: MyISAM tables are read-only while they are being backed up.

Instalation

- Install the xtrabackup package from AUR.

Note: If you are using a AUR helper, like yaourt, this will do the work:
# yaourt -Sy xtrabackup

Usage Examples

XtraBackup is really a set of three tools:

  • xtrabackup - a compiled C binary, which copies only InnoDB and XtraDB data
  • innobackupex - a wrapper script that provides functionality to backup a whole MySQL database instance with MyISAM, InnoDB, and XtraDB tables.
  • tar4ibd - tars InnoDB data safely.

In all of the below examples, the following is assumed:

  • You are backing up a server whose data is stored in /var/lib/mysql/, which is the standard location for Archlinux
  • You are storing the backups in /data/backups/mysql
  • You have a my.cnf file in a standard location, such as /etc/my.cnf, with at least the following contents:
[mysqld]
datadir=/var/lib/mysql/
[xtrabackup]
target_dir=/data/backups/mysql/

xtrabackup

Making the backup copies the InnoDB data and log files to the destination. Preparing the backup makes the data files consistent and ready to use.

  • Make a backup:
# xtrabackup --backup

Prepare the backup:

# xtrabackup --prepare

Prepare again, to create fresh InnoDB log files:

# xtrabackup --prepare

The exit status of a successful xtrabackup is 0. In the second --prepare step, you should see InnoDB print messages similar to “Log file ./ib_logfile0 did not exist: new to be created”, followed by a line indicating the log file was created. Relevant Configuration

You might want to set the --use-memory option to something similar to the size of your buffer pool, if you are on a dedicated server that has enough free memory. The complete documentation of the tool is here.