【问题标题】:mariabackup: empty backup filemariabackup:空备份文件
【发布时间】:2018-07-31 04:45:27
【问题描述】:

我正在尝试在 CentOS 7.5 上的 MariaDB Server 10.2.15 中自动备份一些 mysql 数据库:

mariabackup --backup --target-dir=/srv/db_backup --databases="wordpress" --xbstream | \ 
openssl enc -aes-256-cbc -k mysecretpassword > \ 
$(date +"%Y%m%d%H").backup.xb.enc

我期望的是/srv/db_backup 中名为$(date +"%Y%m%d%H").backup.xb.enc 的文件

我在我的主目录中找到一个名为 $(date +"%Y%m%d%H").backup.xb.enc 的文件,文件大小为 0,/srv/db_backup 目录如下所示:

[root@wordpressdb1 ~]# ls -la /srv/db_backup/
total 77868
-rw-------  1 root root    16384 Jul 31 14:30 aria_log.00000001
-rw-------  1 root root       52 Jul 31 14:30 aria_log_control
-rw-------  1 root root      298 Jul 31 14:30 backup-my.cnf
-rw-------  1 root root      938 Jul 31 14:30 ib_buffer_pool
-rw-------  1 root root 79691776 Jul 31 14:30 ibdata1
-rw-------  1 root root     2560 Jul 31 14:30 ib_logfile0
drwx------  2 root root       19 Jul 31 14:30 wordpress
-rw-------  1 root root      103 Jul 31 14:30 xtrabackup_checkpoints
-rw-------  1 root root      458 Jul 31 14:30 xtrabackup_info

运行 mariabackup 命令的所有进一步尝试均失败:

mariabackup: Can't create/write to file '/srv/db_backup/ib_logfile0' \
(Errcode: 17 "File exists")
mariabackup: error: failed to open the target stream for 'ib_logfile0'.

我做错了什么?

编辑 第一个错误是 openssl -aes-256-cbc 中缺少破折号

现在我看到了:

180731 15:18:37 Executing FLUSH NO_WRITE_TO_BINLOG TABLES...
Error: failed to execute query FLUSH NO_WRITE_TO_BINLOG TABLES: Access \
denied; you need (at least one of) the RELOAD privilege(s) for this operation

我已将 SUPER 和 RELOAD 都授予 root 用户,但仍然出现此错误。

【问题讨论】:

    标签: mariadb centos7 database-backups


    【解决方案1】:

    部分答案:

    “我期望的是/srv/db_backup中的一个名为$(date +"%Y%m%d%H").backup.xb.enc的文件”——那么你需要指定一个目录而不是当前目录:

    mariadbdump ... > \
    /srv/db_backup/$(date +"%Y%m%d%H").backup.xb.enc
    

    至于“写不出来”,你从何而来

    ls -ld /srv/db_backup
    

    【讨论】:

      【解决方案2】:

      您需要使用 --stream=xbstream ,而不是 --xbstream

      您备份到目录,而不是流中。

      【讨论】:

        猜你喜欢
        • 2023-02-26
        • 2023-01-30
        • 1970-01-01
        • 1970-01-01
        • 2019-07-28
        • 2020-08-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多