Database Installation and Configuration

Database Installation and Configuration

MongoDB, version 4 or greater is required for the OCS. The MongoDB community edition is sufficient for OCS functionality, while enterprise edition features includes several production enterprise features such as encryption at rest and replication that is sensitive to WAN replication between data-centres.

Installation

Install MongoDB according to the official instructions or as appropriate other instructions.

Configuration

MongoDB configuration for performance is critical for OCS services. Make the following configuration changes to any production MongoDB instance used by the OCS:

Transparent Huge Pages

As recommended by the MongoDB documentation, disable transparent huge pages in Linux using a systemd service. The MongoDB transparent huge page documentation provides specific steps for this actin.

Disable atime for MongoDB

For improved IOPs, disable the update of the access time (atime) on the drives holding the mongodb database files. The specific change required to perform this action will differ based on system structure. The general approach is to:

  1. Design the OCS storage solution to separate MongoDB datafiles to a separate drive to the OS.
  2. Edit the /etc/fstab configuration file and configure the datafile drive with the noatime configuration option.

System Configuration

Set the following system configuration at minimum in /etc/sysctl.conf or equivalent:

fs.file-max=98000
kernel.pid_max=64000
kernel.threads-max=64000
vm.max_map_count=128000
vm.swappiness=10

System Security Limits for MongoDB

Set the following limits for the mongod user in /etc/security/limits.d/mongodb.conf:

mongod soft nproc 64000
mongod hard nproc 64000
mongod soft nofile 64000
mongod hard nofile 64000

Configuration

Increase the commit interval for disk commits for MongoDB specifically. On the command line:

mongod --setParameter commitIntervalMs=200 

Alter MongoDB to reply to the primary server prior to the secondary server writing the update to disk:

mongod --setParameter writeConcernMajorityJournalDefault=false