Upgrading to MongoDB 3.2 Using Wired Tiger
- 1 Purpose
- 2 Steps
- 3 Procedure
- 3.1 Ensure MongoDB Authentication Is Set Correctly
- 3.2 Stop Running OMK Services
- 3.3 Backup Current Database
- 3.3.1 Create Backup Directory
- 3.3.2 Dump MongoDB
- 3.3.3 Stop MongoDB
- 3.4 Install MongoDB 3.2
- 3.5 Provision MongoDB 3.2
- 3.5.1 Check what kinds of MongoDB configuration files are in /etc
- 3.5.2 Provision MongoDB
- 3.5.2.1 /etc/mongod.conf
- 3.5.3 Delete temporary files associated with MongoDB
- 3.5.4 Delete the contents of /data/mongodb and verify the group and owner of /data/mongodb is mongod.
- 3.5.5 Start MongoDB Service
- 3.5.6 Restore The Database
- 3.5.7 Setup MongoDB for OMK Applicatons
- 3.6 Restart OMK Services and Test
- 3.6.1 Restart Services
- 3.6.2 Test
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
Ensure MongoDB Authentication Is Set Correctly
Stop Running Services
Backup Current Database
Install MongoDB 3.2
Provision MongoDB 3.2
Restart OMK Services and Test
Procedure
Ensure MongoDB Authentication Is Set Correctly
In order to ensure a smooth transistion ensure MongoDB authentication is set correctly. The following script will facilitate this.
[root@opmantek ~]# /usr/local/omk/bin/setup_mongodb.pl Stop Running OMK Services
[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 opflowd stop
Shutting down flowd: [ OK ]
Backup Current Database
Create Backup Directory
[root@opmantek /]# mkdir data/mongodumpDump MongoDB
[root@opmantek ~]# mongodump -u=opUserRW -p=op42flow42 --out=/data/mongodumpStop MongoDB
[root@opmantek ~]# service mongod stop
Stopping mongod: [ OK ]
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=1Install MongoDB 3.2 with yum
[root@opmantek ~]# yum install mongodb-orgProvision 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.rpmnewIf 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.confProvision MongoDB
Now make the following changes to mongod.conf
Change the dbPath to /data/mongodb
Provision wiredTiger (uncomment)
/etc/mongod.conf
--snip
# Where and how to store data.
storage:
dbPath: /data/mongodb
journal:
enabled: true
# engine:
# mmapv1:
wiredTiger:
--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.
Delete the contents of /data/mongodb and verify the group and owner of /data/mongodb is mongod.
[root@opmantek ~]# cd /data/mongodb
[root@opmantek mongodb]# rm -rf *
[root@opmantek mongodb]# cd ..
[root@opmantek data]# ls -l | grep mongodb
drwxr-xr-x 2 mongod mongod 4096 2017-04-05 17:42 mongodbStart MongoDB Service
[root@opmantek ~]# service mongod start
Starting mongod: [ OK ]
[root@opmantek ~]# Restore The Database
[root@opmantek ~]# mongorestore /data/mongodumpSetup MongoDB for OMK Applicatons
[root@opmantek ~]# /usr/local/omk/bin/setup_mongodb.pl Restart OMK Services and Test
Restart Services
[root@opmantek mongodb]# service opeventsd start
Starting opevents daemon opeventsd [ OK ]
[root@opmantek mongodb]# service opconfigd start
Starting opconfig daemon opconfigd [ OK ]
[root@opmantek mongodb]# service opflowd start
Starting opflowd: [ OK ]
[root@opmantek mongodb]# service omkd start
Starting Opmantek Webserver opmantek.exe [ OK ]Test
Log into each OMK Application via the GUI and verify the data is still there. If everything is as it should be then delete /data/mongodump