mongodb: how to upgrade db? - mongodb

Hey I have mongodb which I have used for a long time. It's version is 1.2.2.
Now I have new server running centos 5.5. I know how to install mongodb on it.
It's version is 1.6.5.
I want to know how I can migrate my db files in /var/lib/mongo/ to 1.6.5?
It's just dbs and collections, no index files at all.
Is there any tools can easily do that for me?

Copy over the original database files to the new server and restart mongod on the new system.
It might be necessary to to start mongod with the --upgrade option in order to migrate existing database files to a new database format (has not changed since 1.4 but possibly between 1.2 and 1.6).

If you want to upgrade to the just released 1.8.0-rc0 detailed instructions are at http://www.mongodb.org/display/DOCS/Upgrading+to+1.8.0

Related

Why does MongoDB advise on upgrading MongoDB incrementally, version-by-version?

Apologies if this question is too open-ended.
I have inherited an aging tech stack and am required to upgrade our 200GB MongoDB Community Edition v3.4 installation (hosted on Ubuntu 20) to MongoDB v5 in order to support some new features.
MongoDB advises that to install v5.0, one must be already on MongoDB v4.4:
https://www.mongodb.com/docs/manual/release-notes/5.0-upgrade-standalone/
They say that if you are on a version older than 4.4, then you need to incrementally upgrade to v4.4 before upgrading to v5.
However, if you follow the links in that official upgrade tutorial, you will find that in order to upgrade to any version of MongoDB, they insist on you upgrading version-by-version, successively.
So for me on v3.4 the upgrade path will look like this:
v3.4 -> v3.6 -> v4.0 -> v4.2 -> v4.4 -> v5.0.13
Following these tutorials:
https://www.mongodb.com/docs/manual/release-notes/3.6-upgrade-standalone/
https://www.mongodb.com/docs/manual/release-notes/4.0-upgrade-standalone/
https://www.mongodb.com/docs/manual/release-notes/4.2-upgrade-standalone/
https://www.mongodb.com/docs/manual/release-notes/4.4-upgrade-standalone/
https://www.mongodb.com/docs/manual/release-notes/5.0-upgrade-standalone/
I'm not entirely sure why this is necessary, as the tutorials themselves seem to mostly involve copying over newer binaries and then setting a feature compatibility version in the database config.
To test whether this was necessary I did a mongodump of our entire v3.4 database and then installed a standalone MongoDB v5.0.13 on the same server and then mongorestore to the new v5.0.13 database. Everything seems to work fine, mongorestore spent two hours recreating all the indexes as its last step (something various articles told me would not happen using the mongodump/mongorestore method).
I am able to connect Mongo clients to this new v5.0.13 Community instance without issue. All the data is there and I am able to query it just fine.
So my question is, why does MongoDB strongly advise doing the upgrade incrementally, one version at a time when dumping the database and restoring it to a new version of MongoDB seems to work just fine?
The only issues I have currently is having to rewrite some client code which is using an older Mongo Java driver. This is something I am going to have to do regardless of the upgrade method I used.
Our MongoDB instance is Community Edition and is a single, standalone instance (not a replica set) so I don't know if this matters. Perhaps the upgrade process described by MongoDB is for Mongo Cloud or for Enterprise?
I'm just looking for clarification on whether the simpler method I tried is going to cause me issues. Maybe I've missed something I hadn't considered.

mongodb installation in pc

I install mongodp from its web but when its complete its not showing anything i can follow my teacher but in c mongodb 6.0 bin mongodb its not opened but in mongosh its work proper it show the version of mongodb and version of mongosh and show database als but i want to follow my teacher so it is necessary to open from bin. plz 😣 help please.
i want to open mongodb from bin but its not opened from bin but its work properly from mongosh. iwant to follow my teacher.
i reinstall mongodb and also delte from c but its not working. i repair it mongodb install repair option but the problem is not solved.
mongo binary is legacy shell and no longer shipped with server binaries. See for details. If you, for some reason, need it, you should download a server binaries < 6.0, like 5.0.14 from here. And just copy mongo binary from there (without the rest server binaries).

Create Strapi App, no option for mongoDB on custom installation type

When attempting to create a Strapi App which is connected to a MongoDB cluster and selecting the custom installation, all online tutorials suggest that "mongodb" should be one of the options in the dropdown list alongside "postgres", "mysql" and "sqlite". However, I am not getting an option for mongodb.
I have tried reinstalling nodejs which then triggered the reinstall of create-strapi-app. I also have mongoDB installed locally.
Strapi has abandoned its support for NoSQL DBs. The MongoDB team might (if at all) write their own connector to MongoDB, however ETA is around July, and stable version ETA is around August.
SQLite is now the default DB. However I believe they recommend using PostgreSQL for production.
try with v3
npx create-strapi-app#3.6.8 fileName
Is running well with MongoDB
This worked for me guys,
Install strapi locally to your system using npm i strapi#alpha -g
Run mongodb locally on your system.
Use strapi new <project name> for creating a new project.
Choose your installation type as "custom"
This will avail "Mongo" on the list of supported Databases for Strapi.
Hope this will work for everyone.
Thanks
Reference:
https://strapi.gitee.io/documentation/3.0.0-alpha.x/guides/databases.html#mongodb-installation

Update Mongodb and keep databases

It is possible to update mongodb (Currently in version 2.0.6 and I need > 2.2) and keep databases ?
Mongodb running on Debian 7
MongoDB 2.0 data files are compatible with 2.2-series binaries without
any special migration process. However, always perform the upgrade
process for replica sets and sharded clusters using the procedures
that follow.
As said on the mongodb release notes. Also when your making an upgrade, since your current version is 2.0.6 you need to upgrade to 2.2 first.
If you want to go up to the latest version you have to keep upgrading version one by one as said on the release notes here.
Upgrading a Standalone version
Download binaries of the latest release in the 2.2 series from the MongoDB Download Page.
Shutdown your mongod instance. Replace the existing binary with the 2.2 mongod binary and restart MongoDB.

should we backup & reload data when upgrade to higher version of MongoDB

Recently, I have updated from MongoDB 1.6 to MongoDB 2.0.
I have populated several collections on MongoDB 1.6. After I upgrade to MongoDB 2.0, then start mongodb with the same --dbpath parameter, I found that all previous store collections are still there.
It seems that I don't have to manually backup and reload data into the newer version.
Question> When should we backup & reload data if we decide to upgrade to new version mongodb?
Thank you
You should always backup your data before changing versions - doesn't matter up or down. I'd recommend using mongodump which is super fast (I can tell from my experience, we were able to dump about 15M documents, 12GB database in 2 minutes). Once you've done this, upgrade the binaries and see if the existing data works. If not, restore from the dump using mongorestore.
It#s clearly documented that the database format did not change. So swapping the binaries should be good enough.