mariadb - mariabackup:空备份文件
问题描述
我正在尝试在 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 用户,但仍然出现此错误。
解决方案
您需要使用--stream=xbstream,而不是--xbstream
您备份到目录,而不是流中。
推荐阅读
- python - 从显示当前值并允许输入的 Web 表单字段中抓取文本
- python - NameError:未定义全局名称“working_dir”
- javascript - 如何从 this.state 中获取价值。未定义的属性
- excel - 将 Excel 转换为 HTM 文件作为服务器上的计划任务
- python - 在 reportlabs renderPM.drawToFile 不工作而 renderPDF.drawToFile 是
- javascript - 找不到模块:错误:无法解析“/var/www/html/proj/resources/js”中的“./components/AllPost.vue”
- java - 计算数组中的唯一值(Java)
- css - 拉伸身体 CSS
- python - DTW,关于C[0,0]初始化的问题
- kubernetes - InitContainer 大约需要 5 分钟才能得到 mysql 的肯定响应