You are here: Installation and Configuration > Manual Installation > Upgrading > Upgrading to MongoDB 3.2.x

2.11 Upgrading to MongoDB 3.2.x

Nitro Web Services 2.1.0 and after requires MongoDB 3.2.x.

Do the following:

  1. Stop the service that uses MongoDB.
    • Red Hat 6-based systems
      [root]# service nitro-web-services stop
    • Red Hat 7-based or SUSE 12-based systems
      [root]# systemctl stop nitro-web-services.service
  2. Confirm that nothing is connected to MongoDB.
    [root]# netstat -antp | egrep '(27017|28017).*ESTABLISHED'
  3. Dump the database.

    [root]# cd /root
    [root]# mongodump -u admin_user -p secret1
    [root]# cp -a dump dump.save
    [root]# rm -rf dump/admin/system.users.* # Cannot restore users.
  4. Install MongoDB 3.2.x.
    • Red Hat 6-based systems
      [root]# service mongod stop
      [root]# chkconfig mongod off
      [root]# cat > /etc/yum.repos.d/mongodb-org-3.2.repo <<'EOF'
      [mongodb-org-3.2]
      name=MongoDB Repository
      baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
      gpgcheck=1
      enabled=1
      gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
      EOF
      [root]# rpm -e --nodeps $(rpm -qa 'mongo*')
      [root]# rm -rf /tmp/mongo*.sock /var/run/mongo* /var/lib/mongo* /var/log/mongo*
      [root]# yum install mongodb-org
      [root]# chkconfig mongod on
      [root]# service mongod start
    • Red Hat 7-based systems
      [root]# systemctl stop mongodb.service
      [root]# systemctl disable mongodb.service
      [root]# cat > /etc/yum.repos.d/mongodb-org-3.2.repo <<'EOF'
      [mongodb-org-3.2]
      name=MongoDB Repository
      baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
      gpgcheck=1
      enabled=1
      gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
      EOF
      [root]# rpm -e --nodeps --noscripts $(rpm -qa 'mongo*')
      [root]# rm -rf /tmp/mongo*.sock /var/run/mongo* /var/lib/mongo* /var/log/mongo* /usr/lib/systemd/system/mongodb.service
      [root]# yum install mongodb-org
      [root]# systemctl enable mongod.service
      [root]# systemctl start mongod.service
    • SUSE 12-based systems
      [root]# systemctl stop mongodb.service
      [root]# systemctl disable mongodb.service
      [root]# zypper addrepo --refresh --no-gpgcheck https://repo.mongodb.org/zypper/suse/12/mongodb-org/3.2/x86_64 mongo-server
      [root]# rpm -e --nodeps $(rpm -qa 'mongo*')
      [root]# rm -rf /tmp/mongo*.sock /var/run/mongo* /var/lib/mongo* /var/log/mongo*
      [root]# zypper -n install mongodb-org
      [root]# systemctl enable mongod.service
      [root]# systemctl start mongod.service
  5. Restore the database.

    [root]# cd /root
    [root]# mongorestore
  6. Create the users.

    [root]# mongo
            use admin
            db.createUser({"user": "admin_user", "pwd": "secret1", "roles": ["root"]})
    
            use nitro-db
            db.createUser({"user": "nitro_user", "pwd": "secret5", "roles": ["dbOwner"]})
            
            exit
  7. Set MongoDB Configuration Options.

    By default, /etc/mongod.conf sets net.bindIp to 127.0.0.1. You will need to change this setting if the MongoDB server needs to be accessible from other hosts or from other interfaces besides loopback. See https://docs.mongodb.com/manual/reference/configuration-options/#net-options for more information.

    # Sample /etc/mongod.conf file
    net:
      port: 27017
      # bindIp: 127.0.0.1
    processManagement:
      fork: true
      pidFilePath: /var/run/mongodb/mongod.pid
    security:
      authorization: enabled
    storage:
      dbPath: /var/lib/mongo
      journal:
        enabled: true
    systemLog:
      destination: file
      logAppend: true
      path: /var/log/mongodb/mongod.log
  8. Restart MongoDB.
    • Red Hat 6-based systems
      [root]# service mongod restart
    • Red Hat 7-based or SUSE 12-based systems
      [root]# systemctl restart mongod.service

© 2017 Adaptive Computing