I attempted 4.0.28 to 6.0 upgradeㅜㅜ I want to know difference with two way to upgrade method!

I’m using the Mongodb “community” version. And i’m using Ubuntu 18.04 (in Linux)
Attempted to upgrade from version 4.0.28 to version 6.0.
I found out late that I had to upgrade from 4.0 to 4.2 :frowning:

After the update, of course, there was an error, and mongod does not run. (When I restart, failed appears)
So I’m going to install 4.0 again.

  1. Can I install 4.2 right away?
  2. And what is the difference between how to update using mongod command and downloading list files?

What is difference below two sites?

The upgrade steps are well documented. The supported upgrade method is stepwise through each major version.

For you, as of today, that will be 4.0.28 → 4.2.24 → 4.4.26 → 5.0.23 → 6.0.12

You should ensure the current version 4.0.28 shut down successfully before upgrading to 4.2

Not sure what the question is here but there are two methods for installation using the package manager or using a tarball install. I would recommend using the package manager to complete install and upgrades.

One is the upgrade instructions, the other is for a new install.

Follow the upgrade instructions for 4.2, the upgrade instructions will direct you to the install instruction, but it will list any important pre-upgrade steap and other prerequisites.

Thank u for answer!

I want to follow the upgrade instructions for 4.2 but I can’t start mongod. So, i can’t use mongo shell.

Now, my mongod version is 6.0.

The previous work I did is as follows.

  1. After installing the public gpg key of version 6, install the list file
  2. Delete list file of version 4
rm /etc/apt/sources.list.d/mongodb-org-4.0.list
  1. Install version 6
sudo apt-get install -y mongodb-org=6.0.10 mongodb-org-database=6.0.10 mongodb-org-server=6.0.10 mongodb-org-mongos=6.0.10 mongodb-org-tools=6.0.10
  1. Delete mongod 4 key

( I followed version 6 installing page)

Can I reinstall my old Mongo version (4.0.28) and update it sequentially through Mongo shell?

Yes.

Recreate the list file and gpg 4.0 should be available for you to install again. It may make upgrade easier if you remove the mongodb-org-6.0.list.

Thank u so much for answer again.

Then, Is it right to follow the following link to install it as a package?
(Process of upgrading from 4.0.28 to 6 version)

Can I back up the /data/db file, uninstall the current version I have (version 6), and then install the new version 4.0.28?

Of course you can. If you are backing up the datafiles directly make sure mongod is not running.

The 6.0 binaries never updated these files anyway due to the original error in this thread.

Backing up your data before an upgrade is a good idea, regular backup should be in place regardless.

1 Like

Thank u for your answer!

Have a nice day~