......................
innobackupex: Backup created in directory '/data/backup/base'
innobackupex: MySQL binlog position: filename 'mysql-bin.000001', position 733
160201 15:26:07 innobackupex: Connection to database server closed
160201 15:26:07 innobackupex: completed OK!
......................................................
xtrabackup: Creating suspend file '/data/backup/incremental_one/xtrabackup_log_copied' with pid '19979'
xtrabackup: Transaction log of lsn (22333659) to (22333659) was copied.
160201 15:39:26 innobackupex: All tables unlocked
innobackupex: Backup created in directory '/data/backup/incremental_one'
innobackupex: MySQL binlog position: filename 'mysql-bin.000001', position 1238
160201 15:39:26 innobackupex: Connection to database server closed
160201 15:39:26 innobackupex: completed OK!
........................................
innobackupex: Backup created in directory '/data/backup/incremental_two'
innobackupex: MySQL binlog position: filename 'mysql-bin.000001', position 1689
160201 15:59:10 innobackupex: Connection to database server closed
160201 15:59:10 innobackupex: completed OK!
模拟故障,删除数据库的数据文件
1
2
3
4
5
# ls /usr/local/webserver/mysql5.6/data/
auto.cnf ib_logfile0 mysql-bin.000001 node1.pid test
db01 ib_logfile1 mysql-bin.index performance_schema zabbix
ibdata1 mysql node1.err sharelinux
# rm -rf /usr/local/webserver/mysql5.6/data/*
innobackupex: Starting to copy InnoDB system tablespace
innobackupex: in '/data/backup/base'
innobackupex: back to original InnoDB data directory '/usr/local/webserver/mysql5.6/data'
innobackupex: Copying '/data/backup/base/ibdata1' to '/usr/local/webserver/mysql5.6/data/ibdata1'
innobackupex: Starting to copy InnoDB undo tablespaces
innobackupex: in '/data/backup/base'
innobackupex: back to '/usr/local/webserver/mysql5.6/data'
innobackupex: Starting to copy InnoDB log files
innobackupex: in '/data/backup/base'
innobackupex: back to original InnoDB log directory '/usr/local/webserver/mysql5.6/data'
innobackupex: Finished copying back files.
160201 16:23:08 innobackupex: completed OK!
查看目录
1
2
3
4
5
6
7
8
9
10
11
12
13
# ll /usr/local/webserver/mysql5.6/data/ #这个目录下的数据已经恢复回来
total 79916
drwxr-x---. 2 root root 4096 Feb 1 16:18 db01
-rw-r-----. 1 root root 79691776 Feb 1 16:18 ibdata1
drwx------. 2 root root 4096 Feb 1 15:26 mysql
drwxr-xr-x. 2 root root 4096 Feb 1 15:26 performance_schema
drwxr-x---. 2 root root 4096 Feb 1 16:13 sharelinux
drwxr-xr-x. 2 root root 4096 Feb 1 15:26 test
-rw-r--r--. 1 root root 22 Feb 1 16:18 xtrabackup_binlog_info
-rw-r-----. 1 root root 91 Feb 1 16:18 xtrabackup_checkpoints
-rw-r--r--. 1 root root 722 Feb 1 16:18 xtrabackup_info
-rw-r-----. 1 root root 2097152 Feb 1 16:09 xtrabackup_logfile
drwx------. 2 root root 12288 Feb 1 15:26 zabbix
1
2
3
4
5
chown mysql:mysql /usr/local/webserver/mysql5.6/data/ -R #将目录更改为mysql用户
pkill mysql #杀死原来的mysql进程,然后重启数据库
service mysqld start