This topic provides recommendations for keeping your MongoDB database up-to-date and working correctly. It includes sections covering the following:
Store MongoDB on a Dedicated Mount Point
MongoDB data can grow quite large depending on the size of your environment and how you configure Predictive Routing. By default, the docker-compose.yml file (which you obtain from Docker.com) specifies /datadir/ as the MongoDB storage location. If you expect to write a lot of data on the MongoDB server, Genesys recommends that you create a separate mount point for that purpose.
- Why? If your OS uses the default configuration, the /datadir/ directory shares storage with the root (/). If your Predictive Routing data files or logs grow too large, they will fill up your hard drive to a point where you might even lose access to the server.
The instructions below assume you are using Logical Volume Manager (LVM) to handle your disks. This example shows how to create a 20G logical volume for your data:
1. Start by creating the new directory, using the following commands:
sudo lvcreate -L 20G -n mongoVolume LVMVolGroup mkfs.ext4 /dev/LVMVolGroup/mongoVolume mkdir /new-datadir mount /dev/LVMVolGroup/projects /new-datadir
2. Update those servers running MongoDB (those with the mongo label). Open the docker-compose.yml file and replace the following text:
volumes: - /datadir:/data/db
volumes: - /new-datadir:/data/db
3. (Optional) If you initialized the application by running the start.sh script, move the data to your new directory:
cd ./scripts/ bash stop.sh mv /datadir/* /new-datadir/
4. Start the application:
Back Up and Restore MongoDB
This section supplies the commands needed to back up and restore MongoDB in a single-site/single-server JOP deployment. For backup and restore instructions for HA environments, see Backing Up Your Data in the Deploying: High Availability topic.
Use the following procedure to back up MongoDB in a single-server (single node) environment:
1. Log into the container:
docker exec -it mongo bash
2. Generate the dump of the /backup file:
mongodump --out /data/db/backup --host localhost:27017
Use the following procedure to restore MongoDB on single node installation:
1. Go to the installation directory:
2. Stop all the application containers:
3. Restart the MongoDB container:
../docker-compose -f "../docker-compose.yml" up -d mongo
4. Start a bash session on the MongoDB container:
docker exec -it mongo bash
5. Log into the container:
mongo solariat_bottle --eval "db.dropDatabase()"
6. Restore the dump from the /backup file:
mongorestore /data/db/backup --host localhost:27017 exit
7. Restart all the application containers: