Tuesday, April 9, 2019

Mongodb 3.4.5 Standalone Community to Enterprise 



Recently, I was given the task of upgrading a Mongodb 3.4.5 standalone community edition to Mongodb 3.4.5 standalone enterprise edition. As I started working on it, I realized that there was very little documentation for versions below 4.0. Here are the steps, issues and workarounds, that I encountered during the upgrade:

  • First shutdown the existing Mongodb Community server using the following command and make sure that there are no other mongo services running: 
service mongod stop
 ps -ef | grep "mongo" 
  • Under /etc/yum.repos.d/ directory, create a mongodb-enterprise.repo file
  • Add the following to the mongodb-enterprise.repo file :
[mongodb-enterprise]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/3.4/$basearch/gpgcheck=1enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
  • Make sure that there is no other repo file in this directory other than the mongodb-enterprise.repo file. 
  • Next, install Mongodb 3.4.5 enterprise by issuing the following command
sudo yum install -y mongodb-enterprise-3.4.5 mongodb-enterprise-server-3.4.5 mongodb-enterprise-shell-3.4.5 mongodb-enterprise-mongos-3.4.5 mongodb-enterprise-tools-3.4.5
  • While installing, you may encounter package conflicting errors. We had to remove the following conflicting packages:
sudo yum remove mongo-10gen-server mongo-10gen-tools mongo-10gen-shell mongo-10gen-mongos mongo-10gen
  • If there is no other conflict, Mongodb enterprise should be installed by now.
  • Next, start Mongodb Enterprise Server with the following command, if using a config file.
/usr/bin/mongod -f /etc/mongod.conf 
  • Sometimes, you will get an error when starting the Mongodb server. Check the mongo logs and address the issues accordingly. We had an issue with the number of open files at the OS level, and increasing the number of open files helped. Mongodb recommended number for open files is 64000 and it can be increased with the following command
 ulimit -n 64000