MongoDB 3.6 Update Issues
-
If you have recently moved to Fedora 28 or Ubuntu 18.04 from an early version and were running MongoDB 3.2 or MongoDB 3.4 you might have discovered that you cannot simply update to MongoDB 3.6, there is a fundamental database incompatibility to be addressed. If you already updated your system, this might prove to be rather difficult to fix as you have already changed your infrastructure.
Of course you could revert to an earlier database backup, but you probably would like to avoid doing that. So what to do?
Well let's leverage the wonders of cloud computing. If you, like me, use a cloud provider (I use Vultr) then this might be easier than you think, and not at all stressful. This is actually super easy.
Step One: Package the File to Process
On your new Fedora 28, Ubuntu 18.04, or other system running MongoDB 3.6 find the directory with your database files. The easiest way to locate this is to look it up in your MongoDB configuration file.
For me on Fedora 28 this is located at /etc/mongod.conf and it ends up pointing to /var/lib/mongodb.
So this makes things easy. We can just...
cd /var/lib tar -czvf mongodb.tgz mongodb/
Build a Temporary Processing Server
Now we have a compressed tar file with our data. If you are like me, the compression is about 2:1. Not bad at all. Why did we need to do this? Because we need to transfer this data to a system with MongoDB 3.4 in order to do the conversion. So next, go to your cloud host and fire up Fedora 27 or Ubuntu 16.04 or a system that runs MongoDB 3.4 Doesn't have to be anything fancy. I used Fedora 27 on Vultr. Only took a few minutes.
Once it has built, you can simply do a MongoDB install on your new machine. For Fedora, this would be:
dnf -y install mongodb-server
Copy Over Our File
Then using SCP or a similar tool, simply copy the file from your production server to this new processing server. Plop that file into /var/lib and then on the new server:
cd /var/lib tar -xzvf mongodb.tgz
Start MongoDB 3.4
Once it is done, you can fire up the MongoDB 3.4 server.
systemctl start mongod
Convert the File
Now log into the instance:
mongo
And once you are in the MongoDB interface, you can run this simple command that only takes a second (or less.)
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ) quit()
Package it Up Again
Once done we can remove the unneeded copy and repackage what we just converted.
rm mongodb.tgz tar -czvf mongodb.tgz mongodb/
Copy the file back and restart MongoDB 3.6
Copy the file back over to the /var/lib location on the production MongoDB 3.6 server. Unpackage it, and we are ready to rock:
cd /var/lib tar -xzvf mongodb.tgz systemctl start mongod
Now you can log into your cloud host and shut down the server that you built for ten minutes. Only cost you a few sense but made the whole conversion quite painless.
-
What a fucked up pain in the ass.
The Mongo team failed bad here.
-
Is this an issue when using the packages from Fedora and Ubuntu repo or from MongoDB repo or both?
-
@black3dynamite the issue seems to be any existing 3.4 that upgrades to 3.6
-
@jaredbusch said in MongoDB 3.6 Update Issues:
What a fucked up pain in the ass.
The Mongo team failed bad here.
They did, this is super weird. And is SO easy to fix, how can 3.6 not have the ability to fix this built in?
-
@black3dynamite said in MongoDB 3.6 Update Issues:
Is this an issue when using the packages from Fedora and Ubuntu repo or from MongoDB repo or both?
Fedora and Ubuntu repos will cause this issue. If you just do your normal 27 -> 28, or 16.04 -> 18.04, or 17.10 -> 18.04 updates, it gets you. No warnings (within the system.) This will be a big problem for people who get MongoDB installed as part of an app in the background and don't know that they are running it!
-
@scottalanmiller said in MongoDB 3.6 Update Issues:
@black3dynamite said in MongoDB 3.6 Update Issues:
Is this an issue when using the packages from Fedora and Ubuntu repo or from MongoDB repo or both?
Fedora and Ubuntu repos will cause this issue. If you just do your normal 27 -> 28, or 16.04 -> 18.04, or 17.10 -> 18.04 updates, it gets you. No warnings (within the system.) This will be a big problem for people who get MongoDB installed as part of an app in the background and don't know that they are running it!
Wiki.js
-
@black3dynamite said in MongoDB 3.6 Update Issues:
@scottalanmiller said in MongoDB 3.6 Update Issues:
@black3dynamite said in MongoDB 3.6 Update Issues:
Is this an issue when using the packages from Fedora and Ubuntu repo or from MongoDB repo or both?
Fedora and Ubuntu repos will cause this issue. If you just do your normal 27 -> 28, or 16.04 -> 18.04, or 17.10 -> 18.04 updates, it gets you. No warnings (within the system.) This will be a big problem for people who get MongoDB installed as part of an app in the background and don't know that they are running it!
Wiki.js
That, too, would be affected. Yes. But only in the 1.x series. Once they go to 2.0, they are dumping MongoDB.