Backup and Restore Database
Last updated
Was this helpful?
Last updated
Was this helpful?
This page describes how to backup and/or restore testgrinder database. Combining backup and restore can be used to transfer the database from one instance of testgrinder to another.
Follow these steps to backup testgrinder database. The generated backup file can be used to Restore the database for the same testgrinder instance or to copy it to another.
Some data stored in the database is encrypted using keys specified in Configuration Files on tg-app instances. It is recommended to convert the configuration files into User Data format as described in Configuration Files and store the User Data along with the database backup file in a safe place.
ssh to the tg-app server and switch to testgrinder user:
List contents of the tg-app/config/provision/.env and note the database URI (the value of the MONGODB_URI setting).
Run command to export the database into a gzipped archive file tg-app-db.gz:
You may test the generated file for integrity:
Copy the generated tg-app-db.gz file off the tg-app instance for safekeeping.
Follow these steps to restore the testgrinder database from a backup file produced by the Backup steps.
Copy the backup file you intend to restore to the tg-app instance.
ssh to the tg-app server and switch to testgrinder user:
List contents of the tg-app/config/provision/.env and note the database URI (the value of the MONGODB_URI setting).
The existing database will be dropped and recreated from the backup file. All data stored in the database will be irrevocably lost.
Restart all tg-app instances.
To copy testgrinder database from one instance to another, follow the Backup step on the source database, transfer the backup file to the target tg-app instance, and follow the Restore steps to restore.
Run command to restore the database from the backup file (tg-app-db.gz here):