关键词:mysql热备工具,ibbackup,mysql物理备份工具
1. 准备
ibbackup 是 InnoDB 提供的收费工具,它支持在线热备 InnoDB 数据,主要有以下特性:
- * Online backup of InnoDB tables — the backup takes place entirely online, without preventing queries or updates.
- * Online backup of MyISAM tables — during the backup of InnoDB tables, read and write access is permitted to MyISAM tables. While the MyISAM tables are being copied, updates (but not reads) to the MyISAM tables are precluded.
- * Compressed backups — the backup of InnoDB files can be compressed at various levels, saving as much as 70% or more of the storage required.
- * Partial backups — you can selectively backup all or only some of your InnoDB tables.
- * High performance — backup time is comparable to file copy, applying logs for recovery is even faster.
- * Unlimited database size — no practical limit to database size or number of tables.
- * Broad platform support — runs on Linux, Windows and leading Unix platforms.
在 innodb官网 申请了个试用版测试下,发现效果还是不错的,不过在我们自己的独特应用环境下,ibbackup 的优势并没有多少。具体的测试结果就不发上来了,有兴趣的同学自己测试看看吧。
ibbackup 只需要识别简单的几个 InnoDB 相关参数即可。它在备份时需要用到2个配置文件,一个是指定在线运行的信息,一个是备份相关信息。例如:
online-my.cnf 告诉 ibbackup 当前正在运行的mysql数据文件所在目录
[mysqld] datadir = /home/mysql innodb_data_file_path = ibdata1:512M:autoextend innodb_data_home_dir = /home/mysql innodb_log_file_size = 256M innodb_log_files_in_group = 3 innodb_log_group_home_dir = /home/mysql
backup-my.cnf 告诉 ibbackup 备份文件存储的目录
[mysqld] datadir = /home/hotbackup innodb_data_file_path = ibdata1:512M:autoextend innodb_data_home_dir = /home/hotbackup innodb_log_file_size = 256M innodb_log_files_in_group = 3 innodb_log_group_home_dir = /home/hotbackup
运行 ibbackup --help,就能看到以下几个主要选项:
[[email protected]]# ibbackup --help Usage: ibbackup [--sleep ms] [--suspend-at-end] [--compress [level]] [--include regexp] my.cnf backup-my.cnf or ibbackup --apply-log [--use-memory mb] [--uncompress] backup-my.cnf or ibbackup --restore [--use-memory mb] [--uncompress] backup-my.cnf
我一般只需要用到 --compress 以及 --uncompress,告诉 ibbackup 压缩/解压缩的级别。
开始备份
备份完成