Update a Mongo 3.2.x standalone to a 3.6.

Mongo does only support incremental updates. This means, that one can only update from one stable release to the next. The even numbered minor versions are always the stable releases.

Getting Started

At first you should check if your application is using features of the MongoDB that may have changed with the new Version. The mongoDB guys have a well maintained Wiki for such things. In our case you have to look here:

  • https://docs.mongodb.com/manual/release-notes/3.4-compatibility/
  • https://docs.mongodb.com/manual/release-notes/3.6-compatibility/

If everything checks out you need the intermediate versions (in our case 3.4.15). The mongdb site offers the download of the latest version here: https://www.mongodb.com/download-center#production . Under the Download Button of each OS Version you find a All Version Binaries Link. Here you can download whatever you need, if your installers like yum doesn’t offer them.

In general you need to follow now the steps described here quite nicely:

  • https://docs.mongodb.com/manual/release-notes/3.4-upgrade-standalone/
  • https://docs.mongodb.com/manual/release-notes/3.6-upgrade-standalone//

NOTE: after a new Version is installed and started, mongo runs in a compatibilty mode and a adminCommand is required to start the internal migration. Don’t wonder If you never did this before, the version 3.4 was the first that offers this.

Update for Ubuntu 16.04

Version 3.2 to 3.4

Before you start, make sure, that no newer Version is available to apt!

  1. Update your aptget to recieve the version 3.4 with sudo echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse " | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
  2. Reload apt packages sudo apt-get update
  3. Open mongo log file with e.g. tail -f /var/log/mongodb/mongod.log
  4. Stop MongoDB in our case it is sudo systemctl stop mongodb
  5. Run sudo apt-get install -y --allow-unauthenticated mongodb-org*
  6. Start MongoDB sudo systemctl start mongodb
  7. Look in the look file, that the right server version is stated on restart
  8. connect to you mongo instance via the mongo shell and run db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
  9. If the Log states no errors we can start updating to Version 3.6

Version 3.4 to 3.6

  1. Update your aptget to recieve the version 3.6 with sudo echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse " | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
  2. Reload apt packages sudo apt-get update
  3. Open mongo log file with e.g. tail -f /var/log/mongodb/mongod.log
  4. Stop MongoDB in our case it is sudo systemctl stop mongodb
  5. Run sudo apt-get install -y --allow-unauthenticated mongodb-org*. NOTE: The new Version provides some updates to the mongo.conf. APT will ask you what todo. I’d suggest to take a look at the diff. If you own conf is close to the original you can keep yours and it should work.
  6. Start MongoDB sudo systemctl start mongodb
  7. Look in the look file, that the right server version is stated on restart
  8. connect to you mongo instance via the mongo shell and run db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )
  9. If the Log states no errors you are done and can drink a coffee or a beer.

by Ilenia Salvadori, Mark Hoffmann, Jürgen Albert