Save MongoDB data

Use of the official Docker image

If you use the official Docker image provided by ProMyze, the default configuration defines a cron task that does daily backups of the database used by Themis. 

Modifying the frequency of the backups

To modify the frequency at which MongoDB does its backups, go to the section dedicated to the MongoDB service in the docker-compose.yml file and update the CRON_MONGO_BACKUP environment variable. That value describes the cron format.

By default, the value is @daily. Here are some examples of values to indicate:

05 * * * * Every hours past one minute
30 6 * * * Everyday at  6.30 am
00 7 * * 0 Everyday at 11.50 pm
30 5 1 * * Every 1st of the month at 5.30 am

The change happens like this in thedocker-compose.yml file

version: '2'
  mongodb:
    image: themis-registry.promyze.com/themis-mongodb:2.6.12
    container_name: mongodb-container
    environment:
     - CRON_MONGO_BACKUP="00 7 * * 0" #The environment variable is here overwritten
    volumes_from:
     - dataonly

You then have to relaunch the database with the following command:

docker-compose up -d

Modify the number of backups kept

We advise not to set a too large value in order to avoid overload the disk space. By default, the value is 5. To modify this value, go to the docker-compose.yml file and in the section dedicated to MongoDB. The MAX_MONGO_BACKUP environment variable indicates the maximum number of backups that will be kept on the hard drive.

version: '2'
  mongodb:
    image: themis-registry.promyze.com/themis-mongodb:2.6.12
    container_name: mongodb-container
    environment:
     - MAX_MONGO_BACKUP=10 #The environment variable is here overwritten
    volumes_from:
     - dataonly

You then have to relaunch the database with the following command:

docker-compose up -d

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.