Automation: Final robust DB restore fixes and updated gitignore rules.
This commit is contained in:
25
scripts/restore_internal.sh
Normal file
25
scripts/restore_internal.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
BACKUP_FILE="${BACKUP_FILE:-/backups/import.gz}"
|
||||
RESTORE_DIR="/restore"
|
||||
|
||||
echo ">>> Phase 0: Wiping restore directory..."
|
||||
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..."
|
||||
cd "${RESTORE_DIR}"
|
||||
ln -sf mariadb_backup_checkpoints xtrabackup_checkpoints || true
|
||||
ln -sf mariadb_backup_info xtrabackup_info || true
|
||||
|
||||
echo ">>> Phase 3: Decompressing data..."
|
||||
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!"
|
||||
Reference in New Issue
Block a user