Percona XtraBackup 2.4 xtrabackup full, incremental backup recovery proc
Common parameters of xtrabackup
-- backup creates a backup and stores it in the-- target-dir directory
-- path to the defaults-file= [MY.CNF] configuration file
-- target-dir=DIRECTORY specifies the path where backups are stored. If the directory does not exist, xtrabackup will create the corresponding directory
-- user name of the user backup account
-- password backup account password
-- path to the datadir=DIRECTORY data directory
-- copy-back copies the previous backups back to their starting directory
-- full xtrabackup backup
[root@localhost] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-defaults-file=/etc/my.cnf-backup--datadir=/var/lib/mysql/-target-dir=/backup/20160722-user root
-- password 'System#2013'
.
160721 20:30:13 [01] Copying. / mysql/user.frm to / backup/20160722/mysql/user.frm
160721 20:30:13 [01]... done
160721 20:30:14 [01] Copying. / mysql/proxies_priv.frm to / backup/20160722/mysql/proxies_priv.frm
160721 20:30:14 [01]... done
160721 20:30:14 [01] Copying. / mysql/proc.MYD to / backup/20160722/mysql/proc.MYD
160721 20:30:14 [01]... done
160721 20:30:14 [01] Copying. / mysql/help_relation.frm to / backup/20160722/mysql/help_relation.frm
160721 20:30:14 [01]... done
160721 20:30:14 Finished backing up non-InnoDB tables and files
160721 20:30:14 [00] Writing xtrabackup_binlog_info
160721 20:30:14 [00]... done
160721 20:30:14 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
Xtrabackup: The latest check point (for incremental): '186651619'
Xtrabackup: Stopping log copying thread.
.160721 20:30:14 > > log scanned up to (186651628)
160721 20:30:14 Executing UNLOCK TABLES
160721 20:30:14 All tables unlocked
160721 20:30:14 [00] Copying ib_buffer_pool to / backup/20160722/ib_buffer_pool
160721 20:30:14 [00]... done
160721 20:30:14 Backup created in directory'/ backup/20160722'
MySQL binlog position: filename 'production-bin.000002', position' 1944th, GTID of the last change '026dc034-4dc2-11e6-a9cb-000c29631605:1-17
Cf291e84-2c89-11e6-b6f0-000c29631605:1-44'
160721 20:30:14 [00] Writing backup-my.cnf
160721 20:30:14 [00]... done
160721 20:30:14 [00] Writing xtrabackup_info
160721 20:30:14 [00]... done
Xtrabackup: Transaction log of lsn (186651619) to (186651628) was copied.
160721 20:30:14 completed OK!
-- full recovery of xtrabackup
-Delete the myisam table
Mysql > show create table fire.t10\ G
* * 1. Row *
Table: t10
Create Table: CREATE TABLE `t10` (
`f1` int (11) DEFAULT NULL
`gc` int (11) GENERATED ALWAYS AS ((`f1` + 1)) STORED
KEY `gc` (`gc`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
Mysql > drop table fire.t10
Query OK, 0 rows affected (0.21 sec)
-prepare the backup for the first time to make the backup data files consistent
[root@localhost 20160722] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-defaults-file=/etc/my.cnf-prepare-target-dir=/backup/20160722/
. InnoDB: New log files created, LSN=186651663
InnoDB: Highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 186652172
InnoDB: Doing recovery: scanned up to log sequence number 186652181
InnoDB: Doing recovery: scanned up to log sequence number 186652181
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: xtrabackup: Last MySQL binlog file position 3212, file name production-bin.000001
InnoDB: Removed temporary tablespace data file: "ibtmp1"
InnoDB: Creating shared tablespace for temporary tables
InnoDB: Setting file'. / ibtmp1' size to 12 MB. Physically writing the file full; Please wait...
InnoDB: File'. / ibtmp1' size is now 12 MB.
InnoDB: 96 redo rollback segment (s) found. 1 redo rollback segment (s) are active.
InnoDB: 32 non-redo rollback segment (s) are active.
InnoDB: Waiting for purge to start
InnoDB: page_cleaner: 1000ms intended loop took 10267ms. The settings might not be optimal. Flushed=0 and evicted=0, during the time.
InnoDB: 5.7.11 started; log sequence number 186652181
Xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 186652200
160721 23:40:39 completed OK!
-prepare the backup for the second time and create a new log file to make the recovery faster; if not executed for the second time-prepare,xtrabackup will automatically create the log file when restore. [root@localhost 20160722] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-defaults-file=/etc/my.cnf-prepare-target-dir=/backup/20160722/
.
Xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
Xtrabackup: innodb_log_group_home_dir =.
Xtrabackup: innodb_log_files_in_group = 2
Xtrabackup: innodb_log_file_size = 50331648
InnoDB: PUNCH HOLE support not available
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Uses event mutexes
InnoDB: GCC builtin _ _ sync_synchronize () is used for memory barrier
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Number of pools: 1
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, total size = 100m, instances = 1, chunk size = 100m
InnoDB: Completed initialization of buffer pool
InnoDB: page_cleaner coordinator priority:-20
InnoDB: Highest supported file format is Barracuda.
InnoDB: Removed temporary tablespace data file: "ibtmp1"
InnoDB: Creating shared tablespace for temporary tables
InnoDB: Setting file'. / ibtmp1' size to 12 MB. Physically writing the file full; Please wait...
InnoDB: File'. / ibtmp1' size is now 12 MB.
InnoDB: 96 redo rollback segment (s) found. 1 redo rollback segment (s) are active.
InnoDB: 32 non-redo rollback segment (s) are active.
InnoDB: Waiting for purge to start
InnoDB: 5.7.11 started; log sequence number 186652219
Xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 186652238
160721 23:44:05 completed OK!
[root@localhost 20160722] # ls-trl
Total 196656
Drwxr-x---. 2 root root 4096 Jul 21 20:30 fire
Drwxr-x---. 2 root root 12288 Jul 21 20:30 sys
Drwxr-x---. 2 root root 4096 Jul 21 20:30 performance_schema
Drwxr-x---. 2 root root 4096 Jul 21 20:30 mysql
-rw-r-. 1 root root 111 Jul 21 20:30 xtrabackup_binlog_info
-rw-r-. 1 root root 785 Jul 21 20:30 ib_buffer_pool
-rw-r-. 1 root root 428 Jul 21 20:30 backup-my.cnf
-rw-r-. 1 root root 677 Jul 21 20:30 xtrabackup_info
-rw-r-. 1 root root 8388608 Jul 21 23:40 xtrabackup_logfile
-rw-r-. 1 root root 50331648 Jul 21 23:40 ib_logfile1
-rw-r--r--. 1 root root 27 Jul 21 23:44 xtrabackup_binlog_pos_innodb
-rw-r-. 1 root root 117 Jul 21 23:44 xtrabackup_checkpoints
-rw-r-. 1 root root 12582912 Jul 21 23:44 ibtmp1
-rw-r-. 1 root root 50331648 Jul 21 23:44 ib_logfile0
-rw-r-. 1 root root 79691776 Jul 21 23:44 ibdata1
-perform restore operation
[root@localhost 20160722] # rsync-rvt-- exclude 'xtrabackup_checkpoints'-- exclude' xtrabackup_logfile'\
>. / / var/lib/mysql
Sending incremental file list
. /
Backup-my.cnf
Ib_buffer_pool
Ib_logfile0
Ib_logfile1
Ibdata1
Ibtmp1
Xtrabackup_binlog_info
Xtrabackup_binlog_pos_innodb
Xtrabackup_info
Fire/
Fire/db.opt
Fire/emp.frm
Fire/emp.ibd
Fire/emp2.frm
Fire/emp2.ibd
Fire/t1.frm
Fire/t1.ibd
Fire/t10.MYD
Fire/t10.MYI
Fire/t10.frm
. Sys/x@0024user_summary_by_statement_latency.frm
Sys/x@0024user_summary_by_statement_type.frm
Sys/x@0024wait_classes_global_by_avg_latency.frm
Sys/x@0024wait_classes_global_by_latency.frm
Sys/x@0024waits_by_host_by_latency.frm
Sys/x@0024waits_by_user_by_latency.frm
Sys/x@0024waits_global_by_latency.frm
Sent 324679831 bytes received 5769 bytes 22392110.34 bytes/sec
Total size is 324618115 speedup is 1.00
-change data directory permissions
[root@localhost 20160722] # chown-R mysql:mysql / var/lib/mysql/
-start the database
[root@localhost 20160722] # service mysqld start
Starting mysqld: [OK]
-View the data in the restored table
Mysql > select table_catalog,table_schema,table_name,table_type,engine,version from information_schema.tables where table_name='t10'
+-+ +
| | table_catalog | table_schema | table_name | table_type | engine | version | |
+-+ +
| | def | fire | T10 | BASE TABLE | MyISAM | 10 |
+-+ +
1 row in set (0.00 sec)
Mysql > select * from fire.t10
+-+ +
| | F1 | gc |
+-+ +
| | 1 | 2 |
| | 2 | 3 |
| | 3 | 4 |
| | 4 | 5 |
| | 5 | 6 |
+-+ +
5 rows in set (0.00 sec)
-- xtrabackup incremental backup
-complete implementation fundamentals
[root@localhost] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-defaults-file=/etc/my.cnf-backup--datadir=/var/lib/mysql/-target-dir=/backup/20160722-user root
-- password 'System#2013'
-- create test tables and insert data
Mysql > create table dept (id int (5), d_name varchar (15), loc varchar (15))
Query OK, 0 rows affected (0.42 sec)
Mysql > insert into dept values (10 recordings, Researchmakers, and ShangHai')
Query OK, 1 row affected (0.06 sec)
Mysql > insert into dept values (20 MaintenanceMaintenance1)
Query OK, 1 row affected (0.00 sec)
Mysql > commit
Query OK, 0 rows affected (0.00 sec)
-perform incremental backup one
[root@localhost] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-- defaults-file=/etc/my.cnf-- backup--target-dir=/backup/inc1-- incremental-basedir=/backup/20160722/-- user root-- password 'System#2013'
. 160722 00:26:18 [00] Writing xtrabackup_binlog_info
160722 00:26:18 [00]... done
160722 00:26:18 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
Xtrabackup: The latest check point (for incremental): '186658935'
Xtrabackup: Stopping log copying thread.
.160722 00:26:18 > > log scanned up to (186658944)
160722 00:26:18 Executing UNLOCK TABLES
160722 00:26:18 All tables unlocked
160722 00:26:18 [00] Copying ib_buffer_pool to / backup/inc1/ib_buffer_pool
160722 00:26:18 [00]... done
160722 00:26:18 Backup created in directory'/ backup/inc1'
MySQL binlog position: filename 'production-bin.000001', position' 918, GTID of the last change '026dc034-4dc2-11e6-a9cb-000c29631605:1-17
Cf291e84-2c89-11e6-b6f0-000c29631605:1-44
Fd17ba52-4fd8-11e6-bd80-000c29631605:1-3'
160722 00:26:18 [00] Writing backup-my.cnf
160722 00:26:18 [00]... done
160722 00:26:18 [00] Writing xtrabackup_info
160722 00:26:18 [00]... done
Xtrabackup: Transaction log of lsn (186658935) to (186658944) was copied.
160722 00:26:18 completed OK!
-- create test tables and insert data
Mysql > create table test2 like test
Query OK, 0 rows affected (0.95sec)
Mysql > insert into test2 select * from test
Query OK, 5 rows affected (0.16 sec)
Records: 5 Duplicates: 0 Warnings: 0
-perform incremental backup II
[root@localhost] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-- defaults-file=/etc/my.cnf-- backup--target-dir=/backup/inc2-- incremental-basedir=/backup/inc1-- user root-- password 'System#2013'
. 160722 00:33:31 [01] Copying. / mysql/proxies_priv.frm to / backup/inc2/mysql/proxies_priv.frm
160722 00:33:31 [01]... done
160722 00:33:31 [01] Copying. / mysql/proc.MYD to / backup/inc2/mysql/proc.MYD
160722 00:33:31 [01]... done
160722 00:33:31 [01] Copying. / mysql/help_relation.frm to / backup/inc2/mysql/help_relation.frm
160722 00:33:31 [01]... done
160722 00:33:31 Finished backing up non-InnoDB tables and files
160722 00:33:31 [00] Writing xtrabackup_binlog_info
160722 00:33:31 [00]... done
160722 00:33:31 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
Xtrabackup: The latest check point (for incremental): '186672619'
Xtrabackup: Stopping log copying thread.
.160722 00:33:31 > > log scanned up to (186672628)
160722 00:33:31 Executing UNLOCK TABLES
160722 00:33:31 All tables unlocked
160722 00:33:31 [00] Copying ib_buffer_pool to / backup/inc2/ib_buffer_pool
160722 00:33:31 [00]... done
160722 00:33:31 Backup created in directory'/ backup/inc2'
MySQL binlog position: filename 'production-bin.000001', position' 1421, GTID of the last change '026dc034-4dc2-11e6-a9cb-000c29631605:1-17
Cf291e84-2c89-11e6-b6f0-000c29631605:1-44
Fd17ba52-4fd8-11e6-bd80-000c29631605:1-5'
160722 00:33:31 [00] Writing backup-my.cnf
160722 00:33:31 [00]... done
160722 00:33:31 [00] Writing xtrabackup_info
160722 00:33:31 [00]... done
Xtrabackup: Transaction log of lsn (186672619) to (186672628) was copied.
160722 00:33:31 completed OK!
-- xtrabackup incremental recovery
-prepare the basics.
[root@localhost] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-defaults-file=/etc/my.cnf-prepare-apply-log-only-target-dir=/backup/20160722/
. Xtrabackup: innodb_log_files_in_group = 2
Xtrabackup: innodb_log_file_size = 50331648
Xtrabackup: using the following InnoDB configuration for recovery:
Xtrabackup: innodb_data_home_dir =.
Xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
Xtrabackup: innodb_log_group_home_dir =.
Xtrabackup: innodb_log_files_in_group = 2
Xtrabackup: innodb_log_file_size = 50331648
Xtrabackup: Starting InnoDB instance for recovery.
Xtrabackup: Using 104857600 bytes for buffer pool (set by-use-memory parameter)
InnoDB: PUNCH HOLE support not available
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Uses event mutexes
InnoDB: GCC builtin _ _ sync_synchronize () is used for memory barrier
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Number of pools: 1
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, total size = 100m, instances = 1, chunk size = 100m
InnoDB: Completed initialization of buffer pool
InnoDB: page_cleaner coordinator priority:-20
InnoDB: Highest supported file format is Barracuda.
InnoDB: xtrabackup: Last MySQL binlog file position 3212, file name production-bin.000001
Xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 186652247
InnoDB: Number of pools: 1
160722 01:13:30 completed OK!
-rollback the basic data to the first incremental backup
[root@localhost] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-defaults-file=/etc/my.cnf-prepare-apply-log-only-target-dir=/backup/20160722/-incremental-dir=/backup/inc1/
. 160722 01:16:56 [01] Copying / backup/inc1/mysql/server_cost.frm to. / mysql/server_cost.frm
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/db.MYD to. / mysql/db.MYD
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/general_log.CSV to. / mysql/general_log.CSV
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/help_category.frm to. / mysql/help_category.frm
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/innodb_table_stats.frm to. / mysql/innodb_table_stats.frm
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/slave_master_info.frm to. / mysql/slave_master_info.frm
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/func.MYD to. / mysql/func.MYD
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/user.frm to. / mysql/user.frm
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/proxies_priv.frm to. / mysql/proxies_priv.frm
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/proc.MYD to. / mysql/proc.MYD
160722 01:16:56 [01]... done
160722 01:16:56 [01] Copying / backup/inc1/mysql/help_relation.frm to. / mysql/help_relation.frm
160722 01:16:56 [01]... done
160722 01:16:56 [00] Copying / backup/inc1//xtrabackup_binlog_info to. / xtrabackup_binlog_info
160722 01:16:56 [00]... done
160722 01:16:56 [00] Copying / backup/inc1//xtrabackup_info to. / xtrabackup_info
160722 01:16:56 [00]... done
160722 01:16:56 completed OK!
-rollback the basic data to the second incremental backup
[root@localhost] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-defaults-file=/etc/my.cnf-prepare-apply-log-only-target-dir=/backup/20160722/-incremental-dir=/backup/inc2/
. 160722 01:19:13 [01] Copying / backup/inc2/mysql/user.MYD to. / mysql/user.MYD
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/server_cost.frm to. / mysql/server_cost.frm
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/db.MYD to. / mysql/db.MYD
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/general_log.CSV to. / mysql/general_log.CSV
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/help_category.frm to. / mysql/help_category.frm
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/innodb_table_stats.frm to. / mysql/innodb_table_stats.frm
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/slave_master_info.frm to. / mysql/slave_master_info.frm
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/func.MYD to. / mysql/func.MYD
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/user.frm to. / mysql/user.frm
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/proxies_priv.frm to. / mysql/proxies_priv.frm
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/proc.MYD to. / mysql/proc.MYD
160722 01:19:13 [01]... done
160722 01:19:13 [01] Copying / backup/inc2/mysql/help_relation.frm to. / mysql/help_relation.frm
160722 01:19:13 [01]... done
160722 01:19:13 [00] Copying / backup/inc2//xtrabackup_binlog_info to. / xtrabackup_binlog_info
160722 01:19:13 [00]... done
160722 01:19:13 [00] Copying / backup/inc2//xtrabackup_info to. / xtrabackup_info
160722 01:19:13 [00]... done
160722 01:19:13 completed OK!
-prepare all backups and create new log files
[root@localhost] # / install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/xtrabackup-defaults-file=/etc/my.cnf-prepare-target-dir=/backup/20160722/
. InnoDB: File'. / ibtmp1' size is now 12 MB.
InnoDB: 96 redo rollback segment (s) found. 1 redo rollback segment (s) are active.
InnoDB: 32 non-redo rollback segment (s) are active.
InnoDB: Waiting for purge to start
InnoDB: Page [page id: space=0, page number=9] log sequence number 186659641 is in the future! Current system log sequence number 186652266.
InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
InnoDB: Page [page id: space=0, page number=10] log sequence number 186659944 is in the future! Current system log sequence number 186652266.
InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
InnoDB: Page [page id: space=0, page number=12] log sequence number 186662606 is in the future! Current system log sequence number 186652266.
InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
InnoDB: Page [page id: space=13, page number=3] log sequence number 186669950 is in the future! Current system log sequence number 186652266.
InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
InnoDB: 5.7.11 started; log sequence number 186652247
InnoDB: Page [page id: space=82, page number=0] log sequence number 186655532 is in the future! Current system log sequence number 186652266.
InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
InnoDB: Page [page id: space=83, page number=0] log sequence number 186663700 is in the future! Current system log sequence number 186652266.
InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
InnoDB: xtrabackup: Last MySQL binlog file position 1421, file name production-bin.000001
Xtrabackup: error: The transaction log file is corrupted.
Xtrabackup: error: The log was not applied to the intended LSN!
Xtrabackup: Log applied to lsn 186652247
Xtrabackup: The intended lsn is 186672619
-stop the database and delete all files under the data file
[root@localhost 20160722] # cd / var/lib/mysql
[root@localhost mysql] # rm-rf *
-perform restore operation
[root@localhost backup] # cd / backup/20160722
[root@localhost 20160722] # rsync-rvt-- exclude 'xtrabackup_checkpoints'-- exclude' xtrabackup_logfile'\
>. / / var/lib/mysql
Sending incremental file list
. /
Backup-my.cnf
Ib_buffer_pool
Ib_logfile0
Ib_logfile1
Ibdata1
. Sys/x@0024schema_table_statistics_with_buffer.frm
Sys/x@0024schema_tables_with_full_table_scans.frm
Sys/x@0024session.frm
Sys/x@0024statement_analysis.frm
Sys/x@0024statements_with_errors_or_warnings.frm
Sys/x@0024statements_with_full_table_scans.frm
Sys/x@0024statements_with_runtimes_in_95th_percentile.frm
Sys/x@0024statements_with_sorting.frm
Sys/x@0024statements_with_temp_tables.frm
Sys/x@0024user_summary.frm
Sys/x@0024user_summary_by_file_io.frm
Sys/x@0024user_summary_by_file_io_type.frm
Sys/x@0024user_summary_by_stages.frm
Sys/x@0024user_summary_by_statement_latency.frm
Sys/x@0024user_summary_by_statement_type.frm
Sys/x@0024wait_classes_global_by_avg_latency.frm
Sys/x@0024wait_classes_global_by_latency.frm
Sys/x@0024waits_by_host_by_latency.frm
Sys/x@0024waits_by_user_by_latency.frm
Sys/x@0024waits_global_by_latency.frm
Sent 324910462 bytes received 5845 bytes 24067874.59 bytes/sec
Total size is 324848462 speedup is 1.00
-change the permissions of the data directory
[root@localhost 20160722] # chown-R mysql.mysql / var/lib/mysql
-- start the database
[root@localhost mysql] # service mysqld start
Starting mysqld: [OK]
Mysql > select * from dept
+-+
| | id | d_name | loc | |
+-+
| | 10 | Research | ShangHai |
| | 20 | Maintenance | GuangZhou |
+-+
2 rows in set (0.00 sec)
Mysql > select * from test2
+-- +
| | id | last_name | first_name | |
+-- +
| | 2 | Allice | Hanks |
| | 5 | David | Beckham |
| | 3 | Lily | Weber |
| | 4 | Lucy | Willis |
| | 1 | Terry | John |
+-- +
5 rows in set (0.00 sec)