Visits: 2315
Perfect MongoDB upgrade instructions from 3.4 to 3.6
Run these instructions on each Windows Server with MongoDB 3.4
First Backup each server with an image. In case something breaks an image can be launched like the original. Snapshots are very hard to recover an OS from, so be sure to do an Image. Do this in the AWS EC2 panel, right click on each instance and select Image then create image.
Run Windows update – from search next to start type windows update, then click to check for updates. Reboot, at the end. Windows Update can take over an hour.
Open a PowerShell window. The default installation of MongoDB on Windows Server 2016 is local without a password. BTW – in 3.6 you can only connect remotely with a password. IN the PowerShell window type “mongo”
At the MongoDB prompt type
db.adminCommand( { setFeatureCompatibilityVersion: “3.4” } )
Close the Powershell Window
Open the Browser and download the installation file for MongoDB 3.6. This is the official mongodb website download.
https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.6.13-signed.msi
Before installing 3.6 stop and disable the mongod service which runs 3.4. Type the word “services” into the Windows search, next to “Start”. Scroll down to Mongodb and stop it, right click and open properties, then set it to disabled. It might show an error when you stop, but don’t worry about it, just make sure that it’s stopped.
Now install by running the downloaded file.
Run the MSI installation file that you downloaded, Not the previous version that is also in the Downloads dir. mongodb-win32-x86_64-2008plus-ssl-3.6.13-signed.msi
Select Complete Installation.
Be sure to UNCHECK the option for Compass. It’s small and easy to miss.
After the installation is successful add the new installation as a service. Run a CMD prompt as administrator. In the search next to “Start” type “cmd” but don’t just press enter. Right click on the
icon and select “run as administrator”. It doesn’t work in PowerShell, even as administrator.
Paste the following into the cmd window, by right clicking.
sc.exe create MongoDB36 binPath= “\”C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe\” –service –config=\”C:\Program Files\MongoDB\Server\3.4\mongod.cfg\”” DisplayName= “MongoDB36” start= “auto”
It should say that it was successful
Now go back into the services. Refresh the list if you don’t see Mongodb36. Right click on MongoDB36 and select start. It should also start without issues.
The MongoDB server is now updated. All APIs, etc. will be calling 3.6
You still need to switch the MongoDB Client run 3.6. All that needs to be done now is to change the PATH so that it runs the 3.6 executble
From start search “System Environment Variables”. Click the environment variables button and edit both administrator and system variable, just change 3.4 to 3.6 in the mongodb path, just switch the 4 for a 6
Open a POwershell windows, Run the Mongo Command and see that you now have 3.6
now try
db.adminCommand( { setFeatureCompatibilityVersion: “3.6” } )
Congratulations, Now you can benefit from the new features of MongoDB 3.6
To see the working version enter at the mongo prompt:
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
It will now show that it is version 3.6
Reboot, and check that all is fine.
Here are some links that I used for my research.
https://ginesys.atlassian.net/wiki/spaces/PUB/pages/1900549/How+To+Set+the+PATH+variable+in+environment+variable+in+Windows
http://dochub.mongodb.org/core/3.6-upgrade-fcv
https://docs.mongodb.com/manual/release-notes/3.6-upgrade-standalone/a
https://stackoverflow.com/questions/42398139/how-to-upgrade-mongodb-on-windows-server
https://docs.mongodb.com/manual/tutorial/insert-documents/
https://docs.mongodb.com/manual/tutorial/upgrade-revision/
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
https://www.mongodb.com/download-center/community?jmp=docs
https://docs.mongodb.com/v3.6/tutorial/install-mongodb-on-windows/
https://appuals.com/how-to-fix-error-1067-the-process-terminated-unexpectedly/
https://stackoverflow.com/questions/51095435/create-the-mongodb-windows-service-command-does-nothing