Getting started with mysql enterprise backup, enterprisebackup
**************************************** * ********************** -- 1. full backup *************************************** * ******************** # mysqlbackup -- defaults-file =/usr/local/mysql/my. cnf \ -- host = 127.0.0.1 -- port = 3306 -- protocol = tcp \ -- user = root -- password = passwd123! -- Databases = "wind" \ -- with-timestamp -- backup-dir =/backup \ -- log-bin-index =/usr/local/mysql/mysql_logs/binary_log/mysqldb01-bin.index \ backup -and-apply-log ---- NOTE: mysqlbackup: INFO: cocould not find binlog index file. binlogs will not be copied for this backup. point-In-Time-Recovery will not be possible. if this is online backup then server may not have started with -- log-bin. you may specify it S location with -- log-bin-index option. # cat/backup/2015-04-051109-39-09/meta/backup_variables.txt | grep 'lsn 'end _ lsn = 70249846start_lsn = 70249472 /***************** * ******** parameter [backup_variables] apply_log_done = 1 # Check whether the ibbackup_logfile file is released (0 indicates no, 1 indicates released) binlog_index = mysqldb01-bin.index # binary log index file binlog_position = mysqldb01-bin.000011: 338 # binary log file size end_lsn = 70249846 # End LSN point has_external_plugins = 0 # external plug-in is_c Ompressed = 0 # Whether to compress (0: NO, 1: Yes) is_incremental = 0 # whether it is an incremental backup file (0: NO, 1: Yes) is_incremental_with_redo_log_only = 0: Only redo logs are configured. When the size of input data redo logs is large, is_onlyinnodb = 0 # Whether to back up only the innodb table is_partial = 1 # whether it is server backup or partial backup (0 indicates full server backup and 1 indicates partial backup) is_skip_unused_pages = 0 meb_version = 3.12.0 # version start_lsn = 70249472 # Start LSN *********************** ****/*********************************** * ************************** --- 2. incremental Backup ******************** **************************************** ** Mysqlbackup -- defaults-file =/usr/local/mysql/my. cnf \ -- host = 127.0.0.1 -- port = 3306 -- protocol = tcp \ -- user = root -- password = passwd123! -- Databases = "wind" \ -- with-timestamp -- log-bin-index =/usr/local/mysql/mysql_logs/binary_log/mysqldb01-bin.index \ -- incremental -- start-lsn = 70249846 \ -- incremental-backup-dir =/backupinc backup mysqlbackup -- defaults-file =/usr/local/mysql/my. cnf \ -- host = 127.0.0.1 -- port = 3306 -- protocol = tcp \ -- user = root -- password = passwd123! -- Databases = "wind" \ -- with-timestamp -- log-bin-index =/usr/local/mysql/mysql_logs/binary_log/mysqldb01-bin.index \ -- incremental -- start-lsn = 138861169 \ -- incremental-backup-dir =/backupinc backup ****************************** ******************************** -- 3. restore a specified tablespace ************************************* * ********************** -- 3.1 merge Incremental backup to full backup ls/backupinc/2015-04-01_1_3-16 2015-04-01_10-10-11-51mysqlbackup -- backup -dir =/backup/2015-04-0%09-39-09 \ -- incremental-backup-dir =/backupinc/2015-04-01_10-010-03-16 \ apply-incremental-backup mysqlbackup -- backup-dir =/backup/2015-04-0%09-39-09 \ -- incremental -dir =/backupinc/2015-04-051110-11-51 \ apply-incremental-backup -- 3.2 simulate deletion of the specified tablespace # cat/usr/local/mysql/my. cnf | grep datadirdatadir =/usr/local/mysql/dataMariaDB [(none)]> show databases; + -------------------- + | Database | + -------------------- + | information_schema | jason | mysql | performance_schema | test | wind | + -------------------- + 6 rows in set (0.01 sec) mariaDB [wind]> select count (*) from t1; + ---------- + | count (*) | + ---------- + | 3000000 | + ---------- + 1 row in set (0.60 sec) mariaDB [(none)]> drop database wind; Query OK, 1 row affected (0.24 sec) MariaDB [(none)]> commit; Query OK, 0 rows affected (0.00 sec) mariaDB [(none)]> show databases; + -------------------- + | Database | + -------------------- + | information_schema | jason | mysql | performance_schema | test | + ------------------ + 5 rows in set (0.00 sec) -- 3.3 restore the specified tablespace mysqlbackup -- defaults-file =/usr/local/mysql/my. cnf \ -- datadir =/usr/local/mysql/data/\ -- log-bin-index =/usr/local/mysql/mysql_logs/binary_log/mysqldb01-bin.index \ -- backup-dir = /backup/2015-04-051109-39-09 \ -- databases = "wind" \ copy-back chown-R mysql/usr/local/mysqlchgrp-R mysql/usr/local/mysql -- 3.4 verify tablespace recovery mariaDB [(none)]> show databases; + -------------------- + | Database | + -------------------- + | information_schema | jason | mysql | performance_schema | test | wind | + -------------------- + 6 rows in set (0.01 sec) mariaDB [wind]> select count (*) from t1; + ---------- + | count (*) | + ---------- + | 3000000 | + ---------- + 1 row in set (0.60 sec)