Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jun 072011

Perform XtraBackup and zip to a file


In the previous article, we have discussed how to perform a hot backup on InnoDB with XtraBackup , but is it possible to zip the result directly to a file?

Sure, you can use the wrapper script came with the XtraBackup - innobackupex

For example, to backup and zip the result files to zipped files, you can use:

# innobackupex --stream=tar ./ | gzip - > backup.tar.gz

May 222011

How to perform hot backup for InnoDB?


You can buy the official backup tool - "InnoDB Hot Backup" if you have the money. But you can also use the free alternative - the Percona XtraBackup

To download and install, you can refer to their web site:

To perform a quick and simple backup, you need:

# sudo xtrabackup --defaults-file=/etc/mysql/my.cnf --backup --target-dir=/tmp/backup --datadir=/var/lib/mysql

Jan 192010

How to dump an MySQL/InnoDB database


To do a point-in-time SQL dump of a InnoDB database, use the mysqldump command with the --single-transaction flag

# mysqldump --master-data=2 --single-transaction huge_db > backup.sql

The binlog position will be written in the backup.sql, which is very useful for database recovery if needed.