Mongodb – Migrate data from an older version of mongodb

backupmigrationmongodbmongodb-3.6restore

How can I backup and restore a large mongodb database (500GB) from a server running an older version (v2.6) than the target one (v3.6)?. The downtime is critical.

We've tried by making a straight copy of the data files as well as filesystem snapshot, but these two methods result in incompatibility issues.

Best Answer

When upgrading any software it's usually a good idea to check the manual first, and read something like this:

To upgrade an existing MongoDB deployment to 3.6, you must be running a 3.4-series release.

To upgrade from a version earlier than the 3.4-series, you must successively upgrade major releases until you have upgraded to 3.4-series. For example, if you are running a 3.2-series, you must upgrade first to 3.4 before you can upgrade to 3.6.

Since your current version is pre-3.4, you'll follow the documentation rabbit hole until you reach the page that tells you how to upgrade from 2.6 -- et voilà, your entire upgrade path lies before you in all its glory.

I guess you'll want to install all the required MongoDB versions on your target server simultaneously and open your database, starting each one in sequence, following each version's upgrade instructions.