Backing Up Countly Server


This documentation gives you an overview of how to backup the Countly server, including the database, important configuration files, and directories.

Method 1: Traditional Mongo Command Line Utilities

In order to back up the MongoDB database that Countly uses, change the directory into a directory where you want your backup files to reside, and run

mongodump --db countly
mongodump --db countly_drill

The commands above will create a dump directory with your database data in it.

You can restore it by changing into the same directory where your backup is and by running:

mongorestore --db countly ./dump/countly
mongorestore --db countly_drill ./dump/countly_drill

Now we need to backup files that keep settings. You would need to preserve these files primarily if you modified them. If you haven't modified them and they are in their default, you do not have to back up those files as they come with all Countly installation.

plugins/drill/config.js (if Countly Enterprise is used)

Additionally, you might want to backup some files that you usually add to countly, like:

frontend/express/public/appimages     //uploaded app images
frontend/express/public/userimages    //uploaded user images
frontend/express/certificates         //push certificates

Method 2: Countly Command Line Utility

For general information about the Countly command-line utility, see this documentation.

Backing up Countly via a command line is easy - you just need to give the following commands:

countly backup /PATH/countly-backup

This will backup all Countly MongoDB files together with all configuration files, user images, and certificates (if any).

When you install a new server and you have an old backup, this command will restore your old files on the new server:

countly restore /PATH/countly-backup

Any applications you have on the new server are kept, and apps that have been previously backed up will show up with their corresponding data.


Incremental Backups

MongoDB, and by extension Countly, does not support incremental backups for MongoDB data.

Instead, you can use LVM snapshots for incremental backups if it is possible on your infrastructure. For more information, review MongoDB's explanation here and their step-by-step guide on how to use LVM snapshots for incremental backups/restores.

Looking for help?