【问题标题】:how to set name of backup directory generated by Percona xtrabackup?如何设置 Percona xtrabackup 生成的备份目录的名称?
【发布时间】:2016-09-26 07:41:06
【问题描述】:

我已经安装了 percona-xtrabackup-24.2.4.4 来对 MySql 数据库进行完整备份。我运行以下命令进行备份

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

它成功创建了一个带有时间戳(e.g. 2016-09-26_12-36)的目录,其中包含完整的数据库备份。

问题是,我想指定输出目录名,默认是用时间戳创建的。

有什么想法吗?我已经阅读了所有提到的选项percona,但一无所获。

【问题讨论】:

    标签: mysql database-backups percona


    【解决方案1】:

    如果我理解清楚我会建议你需要像这样的东西

    innobackupex --user=yourDBuser --password=MaGiCdB1 --no-timestamp /path/to/backupdir
    

    在哪里

    --no-timestamp 键告诉不要创建时间戳目录来存储备份

    /path/to/backupdir - 备份文件的路径

    您可以在此处找到有关 --no-timestamp 选项的信息

    https://www.percona.com/doc/percona-xtrabackup/2.2/innobackupex/creating_a_backup_ibk.html

    【讨论】:

      【解决方案2】:

      Bilal,对于更新版本的 Percona Xtrabackup,您不需要使用 innobackupex 脚本。 xtrabackup 二进制文件可以为您创建备份。使用以下符号,您可以使用自定义输出目录创建备份;

      [moore@randy backup]$ pwd
      /data/backup
      
      [moore@randy 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!
      
      [moore@randy backup]$ ls -l
      drwxr-x---. 7 root root 4096 Sep 27 13:15 full_backup
      
      [moore@randy 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
      

      【讨论】:

      • 是的,它有效,我试过这个命令,xtrabackup --user=user --password=pass --backup --target-dir=path_with_formated_dir_name 感谢您的意见,但正在尝试使用 innobackupex
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-08
      • 2014-12-04
      • 1970-01-01
      相关资源
      最近更新 更多