标签:
aiapple@ubuntu:~$ innobackupex-1.5.1 --user=root --password=000000 --defaults-file=/tmp/mysqldata/my.cnf dbbackup/ innobackupex-1.5.1: Backup created in directory ‘/home/aiapple/dbbackup/2016-08-20_06-16-26‘ innobackupex-1.5.1: MySQL binlog position: filename ‘mysql-bin.000001‘, position 1643 160820 06:16:30 innobackupex-1.5.1: Connection to database server closed 160820 06:16:30 innobackupex-1.5.1: completed OK!
aiapple@ubuntu:~$ innobackupex-1.5.1 --user=root --password=000000 --defaults-file=/tmp/mysqldata/my.cnf --incremental --incremental-dir dbbackup/2016-08-20_06-16-26/ dbbackup/ innobackupex-1.5.1: Backup created in directory ‘/home/aiapple/dbbackup/2016-08-20_06-24-08‘ innobackupex-1.5.1: MySQL binlog position: filename ‘mysql-bin.000001‘, position 1749 160820 06:24:13 innobackupex-1.5.1: Connection to database server closed 160820 06:24:13 innobackupex-1.5.1: completed OK! #备份成功 aiapple@ubuntu:~$ ls dbbackup/ 2016-08-20_06-16-26 2016-08-20_06-24-08
aiapple@ubuntu:~$ innobackupex-1.5.1 --user=root --password=000000 --defaults-file=/tmp/mysqldata/my.cnf --stream=xbstream dbbackup/ > dbbackup/stream.bak innobackupex-1.5.1: Backup created in directory ‘/home/aiapple/dbbackup‘ innobackupex-1.5.1: MySQL binlog position: filename ‘mysql-bin.000001‘, position 1749 160820 06:28:06 innobackupex-1.5.1: Connection to database server closed 160820 06:28:06 innobackupex-1.5.1: completed OK! #备份成功 aiapple@ubuntu:~$ ls dbbackup/ 2016-08-20_06-16-26 2016-08-20_06-24-08 stream.bak
aiapple@ubuntu:~$ innobackupex-1.5.1 --user=root --password=000000 --defaults-file=/tmp/mysqldata/my.cnf --parallel=4 dbbackup/ innobackupex-1.5.1: Backup created in directory ‘/home/aiapple/dbbackup/2016-08-20_06-36-34‘ innobackupex-1.5.1: MySQL binlog position: filename ‘mysql-bin.000001‘, position 1749 160820 06:36:38 innobackupex-1.5.1: Connection to database server closed 160820 06:36:38 innobackupex-1.5.1: completed OK! #备份成功 aiapple@ubuntu:~$ ls dbbackup/ 2016-08-20_06-16-26 2016-08-20_06-24-08 2016-08-20_06-36-34 stream.bak
aiapple@ubuntu:~$ innobackupex-1.5.1 --user=root --password=000000 --defaults-file=/tmp/mysqldata/my.cnf --throttle=10 dbbackup/ innobackupex-1.5.1: Backup created in directory ‘/home/aiapple/dbbackup/2016-08-20_06-38-26‘ innobackupex-1.5.1: MySQL binlog position: filename ‘mysql-bin.000001‘, position 1749 160820 06:38:31 innobackupex-1.5.1: Connection to database server closed 160820 06:38:31 innobackupex-1.5.1: completed OK! #备份成功 aiapple@ubuntu:~$ ls dbbackup/ 2016-08-20_06-16-26 2016-08-20_06-36-34 stream.bak 2016-08-20_06-24-08 2016-08-20_06-38-26
aiapple@ubuntu:~$ innobackupex-1.5.1 --user=root --password=000000 --defaults-file=/tmp/mysqldata/my.cnf --compress --compress-thread 4 dbbackup/ innobackupex-1.5.1: Backup created in directory ‘/home/aiapple/dbbackup/2016-08-20_06-40-26‘ innobackupex-1.5.1: MySQL binlog position: filename ‘mysql-bin.000001‘, position 1749 160820 06:40:30 innobackupex-1.5.1: Connection to database server closed 160820 06:40:30 innobackupex-1.5.1: completed OK! #备份成功 aiapple@ubuntu:~$ ls dbbackup/ 2016-08-20_06-16-26 2016-08-20_06-36-34 2016-08-20_06-40-26 2016-08-20_06-24-08 2016-08-20_06-38-26 stream.bak
innobackupex --help | less
mysql> show tables; +--------------+ | Tables_in_tt | +--------------+ | course | | t1 | +--------------+ 3 rows in set (0.00 sec) aiapple@ubuntu:~$ innobackupex --user=root --password=000000 --defaults-file=/tmp/mysqldata/my.cnf dbbackup/ #备份成功; aiapple@ubuntu:~$ ls dbbackup/ 2016-08-20_06-16-26
mysql> drop table t1; Query OK, 0 rows affected (0.02 sec) mysql> show tables; +--------------+ | Tables_in_tt | +--------------+ | course | +--------------+ 1 row in set (0.00 sec)
aiapple@ubuntu:~$ innobackupex --apply-log dbbackup/2016-08-20_06-16-26 InnoDB: Starting shutdown... InnoDB: Shutdown completed; log sequence number 1638934 160820 06:46:20 innobackupex: completed OK!
aiapple@ubuntu:~/dbbackup/2016-08-20_06-16-26$ ls backup-my.cnf mysql xtrabackup_binlog_info ibdata1 performance_schema xtrabackup_checkpoints ib_logfile0 tt xtrabackup_logfile ib_logfile1 xtrabackup_binary
aiapple@ubuntu:~/dbbackup$ innobackupex --defaults-file=/tmp/mysqldata/my.cnf --user=root --password=000000 --copy-back 2016-08-20_06-16-26/ innobackupex-1.5.1: Copying ‘/home/aiapple/dbbackup/2016-08-20_06-16-26/ib_logfile1‘ to ‘/tmp/mysqldata/node1/ib_logfile1‘ innobackupex-1.5.1: Finished copying back files. 160820 07:11:09 innobackupex-1.5.1: completed OK!
mysql> show tables; +--------------+ | Tables_in_tt | +--------------+ | course | | t1 | +--------------+ 2 rows in set (0.00 sec)
mysql> show tables; +--------------+ | Tables_in_tt | +--------------+ | course | | t1 | +--------------+ 2 rows in set (0.00 sec) mysql> create table zengliang(a int ,b int); Query OK, 0 rows affected (0.06 sec)
aiapple@ubuntu:~$ innobackupex --user=root --password=000000 --defaults-file=/tmp/mysqldata/my.cnf --incremental --incremental-dir dbbackup/2016-08-20_06-16-26/ dbbackup/ innobackupex-1.5.1: MySQL binlog position: filename ‘mysql-bin.000001‘, position 1749 160820 06:24:13 innobackupex-1.5.1: Connection to database server closed 160820 06:24:13 innobackupex-1.5.1: completed OK!
aiapple@ubuntu:~$ ls dbbackup/ 2016-08-20_06-16-26 2016-08-20_06-24-08
aiapple@ubuntu:~/dbbackup$ innobackupex --apply-log --redo-only 2016-08-20_06-16-26
aiapple@ubuntu:~/dbbackup$ innobackupex --apply-log --incremental-dir=(增量备份目录) (基础备份目录)
aiapple@ubuntu:~/dbbackup$ innobackupex --defaults-file=/tmp/mysqldata/my.cnf --user=root --password=000000 --copy-back 2016-08-20_06-16-26/ innobackupex-1.5.1: Copying ‘/home/aiapple/dbbackup/2016-08-20_06-16-26/ib_logfile1‘ to ‘/tmp/mysqldata/node1/ib_logfile1‘ innobackupex-1.5.1: Finished copying back files. 160820 07:11:09 innobackupex-1.5.1: completed OK!
aiapple@ubuntu:~/dbbackup/mysql3309$ cat xtrabackup_binlog_info mysql-bin.000002 1467
aiapple@ubuntu:/tmp/mysqldata/node1$ mysqlbinlog -vv mysql-bin.000002 | less # at 1958 #160820 9:10:29 server id 1 end_log_pos 2078 CRC32 0x683bcdc6 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1471698629/*!*/; insert into t6 values(111,222),(333,444),(555,666) /*!*/; # at 2078 #160820 9:10:29 server id 1 end_log_pos 2109 CRC32 0xf264071a Xid = 104 COMMIT/*!*/; # at 2109 #160820 9:11:51 server id 1 end_log_pos 2184 CRC32 0x3f63ae99 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1471698711/*!*/; BEGIN /*!*/; # at 2184 #160820 9:11:51 server id 1 end_log_pos 2298 CRC32 0x5c3b7667 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1471698711/*!*/; insert into t6 values(11,22),(33,44),(55,66) /*!*/; # at 2298 #160820 9:11:51 server id 1 end_log_pos 2329 CRC32 0x4ea5c481 Xid = 114 COMMIT/*!*/;
aiapple@ubuntu:/tmp/mysqldata/node1$ mysqlbinlog -vv --start-position=1467 --stop-position=2298 mysql-bin.000002 | mysql -uroot -p --socket=/home/aiapple/dbbackup/mysql3309/mysql.sock
aiapple@ubuntu:/tmp/mysqldata/node1$ mysqlbinlog -vv --start-datetime=‘2016-08-20 9:03:58‘ --stop-datetime=‘2016-08-20 9:11:51‘ mysql-bin.000002 | cat
标签:
原文地址:http://www.cnblogs.com/Aiapple/p/5793883.html