Enhance DB automation: Added conference export, absolute path restore logic, and automated multi-user credential resetting. Updated README and CHEATSHEET.
This commit is contained in:
@@ -11,10 +11,13 @@ echo "[$(date)] Starting Scheduled Backup..."
|
||||
|
||||
# We use the Docker CLI inside this container to talk to the MariaDB container
|
||||
# The password is taken from the environment variable passed to this service
|
||||
docker exec ${CONTAINER_MARIADB} mariabackup --user=root --password="${AE_DB_PASSWORD}" \
|
||||
docker exec ${CONTAINER_MARIADB} mariabackup --user=root --password="${AE_DB_ROOT_PASSWORD}" \
|
||||
--backup --stream=xbstream --open-files-limit=65535 | gzip > "${BACKUP_FILE}"
|
||||
|
||||
echo "[$(date)] Backup Complete: ${BACKUP_FILE}"
|
||||
|
||||
# Ensure host user can manage the backup files
|
||||
chown 1000:1000 "${BACKUP_FILE}"
|
||||
|
||||
# Optional: Clean up backups older than 7 days
|
||||
find "${BACKUP_DIR}" -name "auto_backup_*.gz" -mtime +7 -delete
|
||||
|
||||
@@ -11,10 +11,16 @@ rm -rf "${RESTORE_DIR:?}"/*
|
||||
echo ">>> Phase 1: Extracting ${BACKUP_FILE} to ${RESTORE_DIR}..."
|
||||
gunzip -c "${BACKUP_FILE}" | mbstream -x -C "${RESTORE_DIR}"
|
||||
|
||||
echo ">>> Phase 2: Fixing checkpoint metadata names..."
|
||||
echo ">>> Phase 2: Metadata Check..."
|
||||
cd "${RESTORE_DIR}"
|
||||
ln -sf mariadb_backup_checkpoints xtrabackup_checkpoints || true
|
||||
ln -sf mariadb_backup_info xtrabackup_info || true
|
||||
if [ -f "mariadb_backup_checkpoints" ] && [ ! -f "xtrabackup_checkpoints" ]; then
|
||||
echo ">>> Linking mariadb_backup_checkpoints to xtrabackup_checkpoints..."
|
||||
ln -sf mariadb_backup_checkpoints xtrabackup_checkpoints
|
||||
fi
|
||||
if [ -f "mariadb_backup_info" ] && [ ! -f "xtrabackup_info" ]; then
|
||||
echo ">>> Linking mariadb_backup_info to xtrabackup_info..."
|
||||
ln -sf mariadb_backup_info xtrabackup_info
|
||||
fi
|
||||
|
||||
echo ">>> Phase 3: Decompressing data..."
|
||||
mariabackup --decompress --target-dir="${RESTORE_DIR}" --open-files-limit=65535
|
||||
@@ -22,4 +28,4 @@ mariabackup --decompress --target-dir="${RESTORE_DIR}" --open-files-limit=65535
|
||||
echo ">>> Phase 4: Preparing backup (Applying logs)..."
|
||||
mariabackup --prepare --target-dir="${RESTORE_DIR}" --open-files-limit=65535
|
||||
|
||||
echo ">>> Restore preparation complete!"
|
||||
echo ">>> Restore preparation complete!"
|
||||
Reference in New Issue
Block a user