2016-09-26 38 views
0

我已經安裝了percona-xtrabackup-24.2.4.4來完成MySql數據庫的完整備份。我運行下面的命令取備份如何設置由Percona xtrabackup生成的備份目錄的名稱?

innobackupex --user=user_name --password=pass dir_path 

它創建的目錄具有時間戳(例如2016-09-26_12-36)的MySQL DB成功,其含有完整的DB備份。

問題是,我想指定輸出目錄名稱,默認情況下這是使用時間戳創建的。

有什麼建議嗎?我已閱讀所有選項percona提到,但一無所獲。

回答

1

Bilal,使用較新版本的Percona Xtrabackup,您不需要使用innobackupex腳本。 xtrabackup二進制文件可以爲您創建備份。使用以下表示法,您可以使用自定義輸出目錄創建備份;

[[email protected] backup]$ pwd 
/data/backup 

[[email protected] backup]$ sudo xtrabackup --user=root \ 
--password=*** \ 
--backup \ 
--target-dir=./full_backup 
160927 13:15:51 Connecting to MySQL server host: localhost, user: root, password: set, port: 0, socket: /var/lib/mysql/mysql.sock 
Using server version 5.7.14-7-log 
xtrabackup version 2.4.4 based on MySQL server 5.7.13 Linux (x86_64) (revision id: df58cf2) 
xtrabackup: uses posix_fadvise(). 
xtrabackup: cd to /var/lib/mysql 
xtrabackup: open files limit requested 0, set to 1024 
xtrabackup: using the following InnoDB configuration: 
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 
... 
160927 13:15:54 Finished backing up non-InnoDB tables and files 
160927 13:15:54 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS... 
xtrabackup: The latest check point (for incremental): '2500658' 
xtrabackup: Stopping log copying thread. 
.160927 13:15:54 >> log scanned up to (2500667) 

160927 13:15:54 Executing UNLOCK TABLES 
160927 13:15:54 All tables unlocked 
160927 13:15:54 [00] Copying ib_buffer_pool to /data/backup/full_backup/ib_buffer_pool 
160927 13:15:54 [00]  ...done 
160927 13:15:54 Backup created in directory '/data/backup/full_backup' 
160927 13:15:54 [00] Writing backup-my.cnf 
160927 13:15:54 [00]  ...done 
160927 13:15:54 [00] Writing xtrabackup_info 
160927 13:15:54 [00]  ...done 
xtrabackup: Transaction log of lsn (2500642) to (2500667) was copied. 
160927 13:15:55 completed OK! 

[[email protected] backup]$ ls -l 
drwxr-x---. 7 root root 4096 Sep 27 13:15 full_backup 

[[email protected] backup]$ sudo ls -l ./full_backup/ 
total 12336 
-rw-r-----. 1 root root  425 Sep 27 13:15 backup-my.cnf 
-rw-r-----. 1 root root  304 Sep 27 13:15 ib_buffer_pool 
-rw-r-----. 1 root root 12582912 Sep 27 13:15 ibdata1 
drwxr-x---. 2 root root  4096 Sep 27 13:15 mysql 
drwxr-x---. 2 root root  8192 Sep 27 13:15 performance_schema 
drwxr-x---. 2 root root  8192 Sep 27 13:15 sys 
drwxr-x---. 2 root root  19 Sep 27 13:15 sysbench 
drwxr-x---. 2 root root  19 Sep 27 13:15 t1 
-rw-r-----. 1 root root  113 Sep 27 13:15 xtrabackup_checkpoints 
-rw-r-----. 1 root root  448 Sep 27 13:15 xtrabackup_info 
-rw-r-----. 1 root root  2560 Sep 27 13:15 xtrabackup_logfile 
+0

是它的工作原理,我已經試過此命令, xtrabackup --user =用戶--password =通--backup --target-dir = path_with_formated_dir_name 感謝您的意見 但試圖與innobackupex – Bilal

相關問題