You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 数据库备份任务
`php xcat backup` 立即备份,`php xcat backupJob` 仅在 `enable_auto_backup` 开启时运行。示例 `crontab` 中的 PHP 和项目绝对路径应按部署位置修改。
备份仅包含配置的主数据库 SQL; `enable_log` 开启时也包含配置的日志数据库 SQL。两个连接完全相同时只导出一次。未启用日志数据库时不会尝试连接它; 已启用却缺少数据库名、用户名或连接无效时会失败, 不会以部分备份冒充完整成功。空数据库主机仅在备份客户端参数中按 `localhost` 处理,不改变网站数据库配置;请确保其 TCP 连接和备份账户权限可用。
需要 `/usr/bin/mariadb-dump` 或 `/usr/bin/mysqldump` ,以及支持 AES-256 的 PHP zip/libzip 扩展。必须配置至少 12 字节的 `auto_backup_passwd` ,缺少口令或加密能力时拒绝备份,没有未加密的降级模式。可配置 `auto_backup_email` 发送加密归档;邮件失败仍保留已经完成的本地备份。
完成的归档位于 `storage/backups/` ,目录权限为 `0700` ,归档和临时凭据权限为 `0600` 。凭据通过临时 `--defaults-extra-file` 传入,不在命令行中暴露;临时 SQL 和凭据在任务结束时删除。历史加密归档不会自动清理。这里只备份数据库,不包含网页、配置或密钥;应用加密密钥需由管理员另行安全备份,否则恢复 SQL 后仍可能无法解密业务信息。跨数据库的两次导出不是一个全局原子快照。