How can I dump and restore db data from 3.6.8 to current 4.4 version?

Hello All,

We are currently running mongodb 3.6.8 version on our server (ubuntu) and we are moving our server to a debain where I have two questions :

  1. How can I Install same 3.6.8 version I tried to do it as mentioned here https://www.mongodb.com/docs/v4.4/tutorial/install-mongodb-on-debian/ by replacing 4.4 with 3.6 however Im getting this error at 3rd step and Is there a way Can I install this old version?
    E: The repository ‘Index of debian buster/mongodb-org/3.6 Release’ does not have a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.

  2. If I go with 4.4 version itself on new server how can I dump data from older 3.6.8 version to this new db?

Please help me ,Thanks!

Hi @priyatham_ik

MongoDB 3.6 series was out of support since April 2021 and thus it won’t receive any bugfixes or improvements anymore. Even if you can install a 3.6 series server, it’s best not to, and use a supported version instead. The oldest supported series is MongoDB 4.2 at this moment.

If you would like to get a fresh 4.4 series installation and move the data from the old deployment to the new one, Stennie posted a great answer here: Replace mongodb binaries all at once? - #3 by Stennie for a similar situation. Please see if the post answers your question.

Best regards
Kevin

Hello @kevinadi ,

I have installed the 4.4 version on new server and did this mentioned below to dump and restore from old db to new db

ssh -fN -L 27018:localhost:27017 <remote_host> 

  mongodump --port 27018 --db <remote_db_name> --username <remote_db_username> --password <remote_db_password> --archive | mongorestore --username <destination_db_username> --password <destination_db_password> --archive

After running these commands on my new server  I see my db when I do show dbs on mongo shell however when I change the port to 27018 in mongodb config file in order to run this restored db its throwing error and exiting with 42 saying address already in use  and Its happening because of the ssh tunnel and when I kill the port and re run it now I dont see the restored DB .

Can anyone help me ?


Hi @priyatham_ik

I think I would try to avoid using SSH tunneling for this operation, since it introduces another layer of complexity in the process.

Instead, I would do the dump & restore process from a node that can directly connect to the servers. This would make the process easier, and you’re not mixing MongoDB restore issues with network issues and have to fix both to make this work.

Best regards
Kevin