9 Backing Up And Restoring the STAP Database
Learn how to backup and restore the Oracle Communications Solution Test Automation Platform (STAP) database.
Topics in this document:
Backing Up the STAP Database
To back up the STAP database, follow these steps:
- Ensure read write to db is disabled by scaling down TDS
deployment:
kubectl scale deployment tds-deployment --replicas=0 -n namespace
- Navigate to the NFS/PV mount, and take a backup of the database
folder. The following is an example script for creating backup
files:
Alternatively, use theecho "Creating backups folder if not exists..." mkdir -p backups echo "Deleting old backup archives..." rm -rf ./backups/*.tar.gz TIMESTAMP=$(date +"%Y%m%d_%H%M%S") BACKUP_DIR="./backups/db_bkp_$TIMESTAMP" echo "Creating new backup at $BACKUP_DIR..." mkdir -p $BACKUP_DIR cp -r db $BACKUP_DIR echo "Compressing backup..." tar -czf "$BACKUP_DIR.tar.gz" -C ./backups "db_bkp_$TIMESTAMP" echo "Removing uncompressed backup folder..." rm -rf $BACKUP_DIR echo "Backup completed: $BACKUP_DIR.tar.gz"
kubectl cp
command to backup the /data/db folder from the TDS pod. For more information, see the Kubernetes documentation:https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cp/
Note:
To access the NFS/PV or pod files, you must have administrator access. - Ensure that the backup is saved to a safe location on separate hardware from your implementation.
- Scale up TDS
deployment:
kubectl scale deployment tds-deployment --replicas=1 -n namespace
Restoring the STAP Database
To restore an already deployed version of STAP, roll back the database to the last
backed up version by following these steps:
- Uninstall the existing TDS microservice by running the following
command:
helm uninstall tds_chart_name -n namespace
- Unzip or untar the previously backed up folder and move it to the NFS mount.
- Rename the folder to db in the root directory of the NFS mount.
- Re-install the TDS microservice. For more information see "Installing TDS".
Migrating Data to a New Environment
If you are setting up a new STAP environment, and want to migrate your data from the
old setup, follow these steps:
- Unzip or untar the previously backed up folder and move it to the NFS mount in the new setup.
- Rename the folder to db in the root directory of the NFS
mount.
Caution:
The NFS database folder should be exclusively allocated and used by only one TDS microservice at a single point in time. - Install the TDS microservice. For more information, see "Installing TDS".