Contents
Database Maintenance
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:
- Create the new directory, using the following commands:
To make the new mount point permanent, update the /.../fstab file.sudo lvcreate -L 20G -n mongoVolume LVMVolGroup mkfs.ext4 /dev/LVMVolGroup/mongoVolume mkdir /new-datadir mount /dev/LVMVolGroup/projects /new-datadir
- Update those servers running MongoDB (those with the mongo label). To do this, open the docker-compose.yml file and replace the following text:
volumes: - /datadir:/data/db
with
volumes: - /new-datadir:/data/db
- (Optional) If you initialized the application by running the start.sh script, move the data to your new directory using the following commands:
cd ./scripts/ bash stop.sh mv /datadir/* /new-datadir/
- Start the application:
bash start.sh
Back Up and Restore MongoDB
This section supplies the commands needed to back up and restore MongoDB in a single-site/single-server AICS deployment. For backup and restore instructions for HA environments, see Backing Up Your Data in the Deploying: High Availability topic.
Using SSL with MongoDB
The procedure below is for MongoDB with SSL enabled. Genesys recommends that you use SSL.
- To use SSL, add the --ssl parameter to your commands.
- In test environments, you can optionally add --sslAllowInvalidCertificates following the --ssl parameter.
- In test environments ONLY, if you need to maintain an environment without SSL connections, omit the --ssl and --sslAllowInvalidCertificates parameters.
Backup MongoDB
Use the following procedure to back up MongoDB in a single-server (single node) environment:
- Log into the container:
docker exec -it mongo bash
- Generate the dump of the /backup file:
mongodump --ssl --out /data/db/backup --host localhost:27017
TipYou can view the /data/db/backup directory for the container from the base system in the /datadir/backup directory if you are using the default defined directory for MongoDB in the docker-compose.yml file.
Restore MongoDB
Use the following procedure to restore MongoDB on single node installation:
- Go to the installation directory:
cd "IP_JOP_PRR_<version_number>_ENU_linux/scripts/"
- Stop all the application containers:
bash stop.sh
- Restart the MongoDB container:
../docker-compose -f "docker-compose.yml" up -d mongo
- Start a bash session on the MongoDB container:
docker exec -it mongo bash
- Log into the container:
mongo solariat_bottle --ssl --eval "db.dropDatabase()"
- Restore the dump from the /backup file:
mongorestore --ssl --drop /data/db/backup --host localhost:27017 exit
- To restart all the application containers, run:
bash install.sh
and then:
bash start.sh