Backing Up and Restoring Agility Sync
Overview
This article describes the process of backing up the data, storing it off-server, and restoring it on an as needed basis.
Agility Sync consists of two areas that should be backed up on a regular basis: MongoDB database and a configuration directory on the file system.
Backup
The backup process requires access to the Agility Sync server. The following commands can be used or customized for use to create a backup tar file.
save the date in a variable
export THISDATE=$(date +%Y-%m-%d_%H-%M)
create a temporary directory
mkdir /tmp/agilityconnect_backup_${THISDATE}
cd /tmp`
create a dump of the Agility Sync MongoDB
mongodump --db agilitysync--out agilitysync_backup_${THISDATE}/agilitysync_mongo
cp /etc/agilitysync/agilitysync.yaml agilitysync_backup_${THISDATE}/agilitysync.yaml
cp /etc/agilitysync/service.conf agilitysync_backup_${THISDATE}/service.conf`
tar and gzip all the directories and files
tar -czf agilitysync_backup_${THISDATE}.tar.gz agilitysync_backup_${THISDATE}`
remove the directory
rm -rf agilitysync_backup_${THISDATE}
At this point you will want to get the file off the Agility Sync server using sftp or scp or some other means such as uploading to object storage like Amazon S3. Then remove the file from the Agility Sync disk using the following command:
rm agilitysync_backup_${THISDATE}.tar.gz
This backup process can be used in a bash script and placed into a cron job or can be run from a scheduled Agility Sync Task. It is important to understand what an acceptable risk may be with regards to how often you run the backup: once a day, once an hour, and so on.
This backup process is in it's simplest form, there may be better options as far as performing snapshots or specific third party database backup technologies that your enterprise be already have at your disposal or may want to explore.
Off-site Storage
Digital.ai Agility does not provide any specific guidance on which method of off-site storage is used, whether that is a cloud-based object storage (Example:. Amazon S3), an ftp server or otherwise. We do recommend that you keep several interactions of backups and test your restore process.
Restoring a Backup
Make sure you have the same version of MongoDB on the server from which you took the backup and the server where you restore the backup. If not, upgrade the MongoDB before you restore the backup.
After choosing the backup version to restore, get the tar.gz file downloaded to the Agility Sync server. If you are recovering from a total and complete failure, you will need to first perform a new install on a new machine. Once the install has completed and the backup file is on the server, perform the following commands.
The first command sets the THISDATE environment variable to the date / time string part of the backup file name as a matter of convenience in the following commands.
\export THISDATE=2016-01-29_04-13
stop the Agility Sync services
as-stop-services
untar the file
tar -xzf agilitysync_backup\_\${THISDATE}.tar.gz
restore the MongoDB
mongorestore --drop --db agilitysync agilitysync_backup\_\${THISDATE}/agilitysync_mongo/agilitysync
restore the config files
cp agilitysync_backup\_\${THISDATE}/agilitysync.yaml /etc/agilitysync/agilitysync.yaml
cp agilitysync_backup\_\${THISDATE}/service.conf /etc/agilitysync/service.conf
start the services
as-start-services
Log in and check your data.