码迷,mamicode.com
首页 > 其他好文 > 详细

percona-xtrabackup系列一:简单使用

时间:2015-05-18 20:30:15      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:

1:什么是percona-xtrabackup

Percona XtraBackup is an open-source hot backup utility for MySQL -based servers that doesn’t lock your database during the backup.

It can back up data from InnoDB, XtraDB,and MyISAM tableson MySQL 5.1 [1], 5.5 and5.6 servers, as well as Percona Server with XtraDB.For a high-level overview of many of its advanced features, including a featurecomparison, please see AboutPercona Xtrabackup.

Whether it is a 24x7 highly loaded server or alow-transaction-volume environment, Percona XtraBackup isdesigned to make backups a seamless procedure without disrupting theperformance of the server in a production environment.Commercial support contracts areavailable.

Percona XtraBackup is a combination of the xtrabackup C program,and the innobackupex Perl script. The xtrabackupprogramcopies and manipulates InnoDB and XtraDB datafiles, and the Perl script enables enhanced functionality,such as interacting with a running MySQL server and backing up MyISAM tables.


2:软件及文档获取
软件下载:https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.2.10/binary/debian/squeeze/x86_64/Percona-XtraBackup-2.2.10-re623acb-squeeze-x86_64-bundle.tar


3:软件使用讲解

a.备份数据
#innobackupex --user=root --password=123456 /databackup/

b.做统一检查
#innobackupex --apply-log /databackup/2014-09-10_11-49-44/


c.模拟数据丢失
#rm -rf /usr/local/mysql/data/*
#ll /usr/local/mysql/data/


d.恢复数据
#innobackupex --copy-back /databackup/2014-09-10_11-49-44/

e.重启mysql服务,发现报错,pkill掉,然后启动一切正常
#/etc/init.d/mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/serv01.host.com.pid).

#查看恢复的数据目录,拥有者和所属组不是mysql用户,我们更改拥有者和所属组
#ll /usr/local/mysql/data/
total 18468
drwxr-xr-x. 2 root root 4096 Sep 10 22:02 game
drwxr-xr-x. 2 root root 4096 Sep 10 22:02 hello
-rw-r-----. 1 root root 18874368 Sep 10 21:51 ibdata1
drwxr-xr-x. 2 root root 4096 Sep 10 22:02 larrydb
drwxr-xr-x. 2 root root 4096 Sep 10 22:02 mnt
drwxr-xr-x. 2 root root 4096 Sep 10 22:02 mysql
-rw-rw----. 1 mysql mysql 0 Sep 10 22:02 mysql-bin.index
drwxr-xr-x. 2 root root 4096 Sep 10 22:02 performance_schema
drwxr-xr-x. 2 root root 4096 Sep 10 22:02 test
-rw-r--r--. 1 root root 24 Sep 10 22:02 xtrabackup_binlog_pos_innodb

#chown mysql.mysql /usr/local/mysql/data/ -R
再次启动即可
#ps -ef | grep mysql


4:参考资料
#http://www.percona.com/doc/percona-xtrabackup/2.1/

percona-xtrabackup系列一:简单使用

标签:

原文地址:http://www.cnblogs.com/xiaoit/p/4512708.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!