Purpose
OMK customers may wish to upgrade MongoDB to 3.2 and realize the efficiencies of Wired Tiger. This example uses CentOS because this is the prevailing Linux distribution used by our customer base.
Steps
- Stop running services
- Backup Current Database
- Install MongoDB 3.2
- Provision MongoDB 3.2
- Convert to Wired Tiger
- Restore services
Procedure
Stop Running Services and Disable opflowd
[root@opmantek ~]# service opconfigd stop Stopping opconfig daemon opconfigd [ OK ] [root@opmantek ~]# service opeventsd stop Stopping opevents daemon opeventsd [ OK ] [root@opmantek ~]# service omkd stop Stopping Opmantek Webserver opmantek.exe [ OK ] [root@opmantek ~]# service mongod stop Stopping mongod: [ OK ] [root@opmantek ~]# service opflowd stop Shutting down flowd: [ OK ] ### disable opflowd [root@opmantek ~]# chkconfig opflowd off
Backup Current Database
Install MongoDB 3.2
Update MongoDB Repository File
In order to install Mondgo3.2 edit /etc/yum.repos.d/mongod-org.repo to reflect the correct version.
/etc/yum.repos.d/mongod-org.repo
### change below to 3.2 [mongodb-org-3.2] name=MongoDB Repository ### change below to 3.2 baseurl=https://repo.mongodb.org/yum/redhat/\$releasever/mongodb-org/3.2/x86_64/ gpgcheck=0 enabled=1
Install MongoDB 3.2 with yum
[root@opmantek ~]# yum install mongodb-org
Provision MongoDB 3.2
Check what kinds of MongoDB configuration files are in /etc
[root@opmantek etc]# ls -l | grep mongo -rw-r--r-- 1 root root 1564 2015-09-11 10:00 mongod.conf -rw-r--r-- 1 root root 768 2017-02-02 02:07 mongod.conf.rpmnew
If there is one called mongodb.conf it is no longer necessary. Please move this to /root to avoid any future confusion.
Make a backup of the old mondgod.conf and copy the new rpm version over it.
[root@opmantek etc]# cp mongod.conf mongod.conf.backup [root@opmantek etc]# cp mongod.conf.rpmnew mongod.conf
Provision MongoDB
Now make the following changes to mongod.conf
- Change the dbPath to /data/mongodb
- Provision wiredTiger
- Uncomment
- Add engineConfig, cacheSizeGB: 8
/etc/mongod.conf
--snip # Where and how to store data. storage: dbPath: /data/mongodb journal: enabled: true # engine: # mmapv1: wiredTiger: engineConfig: cacheSizeGB: 8 --snip
Delete temporary files associated with MongoDB
Remove any files in /tmp that look be be associated with MongoDB
If there is a mongod.pid file in /var/run/mongodb, then remove it.
If there is a /data/mongodb/mongod.lock file, then remove it.
[root@opmantek ~]# chown -R mongod:mongod /data/mongodb/
Start MongoDB Service