MongoDB is the leading NoSQL database,
designed for how we build and run applications today. MongoDB empowers
organizations to be agile and scalable. It helps them enable new types
of applications, improve customer experience, accelerate time to market
and reduce total cost of ownership (TCO). MongoDB is named from
"huMONGOus" meaning "extremely large".
MongoDB is a general purpose, open-source database. MongoDB features:
- Document data model with dynamic schemas
- Full, flexible index support and rich queries
- Auto-Sharding for horizontal scalability
- Built-in replication for high availability
- Text search
- Advanced security
- Aggregation Framework and MapReduce
- Large media storage with GridFS
After having a overview of
what Mongodb is,Lets have look on how to upgrade Mongodb to its latest
version on Ubuntu.In the general case, the upgrade from MongoDB 2.2 to
2.4 is a
binary-compatible “drop-in” upgrade: shut down the mongod
instances and replace them with mongod instances running
2.4. However, before you attempt any upgrade please familiarize
yourself with the Recommendations and Checklist
When upgrading, consider the following:
- For all deployments using authentication, upgrade the drivers (i.e. client libraries), before upgrading the mongod instance or instances.
- To upgrade to 2.4 sharded clusters must upgrade following the meta-data upgrade procedure.
- If you’re using 2.2.0 and running with auth enabled, you will need to upgrade first to 2.2.1 and then upgrade to 2.4. See Rolling Upgrade Limitation for 2.2.0 Deployments Running with auth Enabled.
- If you have system.users documents (i.e. for auth) that you created before 2.4 you must ensure that there are no duplicate values for the user field in the system.users collection in any database. If you do have documents with duplicate user fields, you must remove them before upgrading.
You can upgrade to 2.4 by performing a “rolling”
upgrade of the set by upgrading the members individually while the
other members are available to minimize downtime. Use the following
procedure:
- Upgrade the secondary members of the set one at a time by shutting down the mongod and replacing the 2.2 binary with the 2.4 binary. After upgrading a mongod instance, wait for the member to recover to SECONDARY state before upgrading the next instance. To check the member’s state, issue rs.status() in the mongo shell.
- Login to one of the secondary in replica set and shutdown the instances.
MongoDB shell version: 2.2.3
connecting to: test
> use admin;
> db.shutdownServer()
- Now Install the Lastest package of Mongod
- Issue the following command to import the 10gen public GPG Key:
- Create a /etc/apt/sources.list.d/10gen.list file and include the following line for the 10gen repository.
- Now issue the following command to reload your repository:
- To install a specific release, append the version number to the package name:
- To install the latest stable version of MongoDB:
Once
you are done with all the above steps successfully,restart the mongodb
and wait for this instances to became secondary and in-sync with the
master.
Now
continue upgrading the remaining secondary members by repeating the
above steps.After you are done with upgrading secondaries to the latest
version It's time to upgrade the master to latest version as well.
- To upgrade master first we need to switch the master,So that one of the Secondary becomes master and the existing master becomes secondary.
MongoDB shell version: 2.2.3
connecting to: test
> use admin;
> rs.StepDown()
- Once the primary has stepped down and another member has assumed PRIMARY state, as observed in the output of rs.status(),Follow the above mentioned steps for upgrading Secondaries in the replica set.
After
all the members of replica set are upgraded to required version,you can
switch back the primary and you are done with upgrade of mongodb.
0 comments:
Post a Comment