Home > linux, manjaro, mongodb > [mongo] Upgrade to version 3.6, 4.0, 4.2

[mongo] Upgrade to version 3.6, 4.0, 4.2

Problem
Under Manjaro, my MongoDB 3.4 was upgraded to version 3.6 and it stopped working. Great!

Solution
In the log file I found this error: “IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.

Visiting the link in the error message, it was suggested to execute a DB command in the mongo shell. But the Mongo server was not willing to start, thus I couldn’t connect to it with the Mongo shell!

So I downgraded to version 3.4 just to be able to start the Mongo shell and execute the command “db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )“. Now I upgraded MongoDB to version 3.6 and it started happily.

Update (20190911)
Today I wanted to update MongoDB 3.6 to MongoDB 4.2 under Manjaro. The package manager contained a binary package that I could install easily but when I started it, the shell was version 4.2 but the server was still version 3.6! A few hours later I figured out that the problem was caused by the old server (v3.6) that was still running when I updated MongoDB. So the winning strategy was the following:

  • Remove 4.2 and put back 3.6. Start the mongo shell to see that everything works.
  • Stop the mongo server: “systemctl stop mongodb“.
  • Update to version 4.0 (using a binary package), start the server (“systemctl start mongodb“) and launch the mongo shell to verify that everything is OK.
  • In the mongo shell issue the command “db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )“.
  • Now we can move on to version 4.2. Stop the mongo server: “systemctl stop mongodb“.
  • Update to version 4.2 (using a binary package), start the server and launch the mongo shell to verify that everything is OK.
  • In the mongo shell issue the command “db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )“.

When you start / stop the server with systemctl, you’ll have to wait a few seconds to see its effect. You can verify the status of the server with “systemctl status mongodb“. It’s highly recommended that you install a binary package. Installing from source takes several hours even on a decent machine.

List of installed mongo packages: “pacman -Q | grep mongo“. When you want to upgrade, it’ll show you what packages to remove.

Categories: linux, manjaro, mongodb Tags: , ,
  1. February 16, 2018 at 19:40

    You are a life saver! Thanks

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: