Category Archives: MongoDB

Mongodb- Architecture

Deployment of Replicated Sharded Cluster in MongoDB


Now let’s set up a 3 node sharded replicated cluster with one config server and two shard servers with their replica set and one query router.

Node 1:

config server, shard server (shard 0000) and primary replica of shard 0000 and secondary replica of the shard 0001

Node 2:

mongos router, shard server (shard 0001) and primary replica of shard 0001 and secondary replica of the shard 0000

Node 3:

Another secondary replica of shard 0001 and another secondary replica of the shard 0000

Continue reading

Read More

Sharding in MongoDB

MongoDB is one of several database types to arise in mid 2000’s under the banner of NoSQL. Rather than using the rows and columns as in the relational databases, MongoDB is built over architecture of collections and documents. Documents contain sets of Key-Value pairs and are the basic unit of data in mongoDB. Collections contain sets of documents and functions as the equivalent of the relational database tables.

Database systems with huge amount of the data sets and high throughput applications normally are a threat to the single server.  They can exceed the storage capacity of a single machine or the high query rates can add on more loads to the CPU capacity of the server leading to exhaust. To overcome these issues, there are two basic approaches: Vertical Scaling and Horizontal Scaling.

Vertical Scaling is adding upon more CPU and storage resources to increase the capacity. But this vertical concept also gives up some limitations like, more expensive to achieve high performance systems, and cloud-based providers allow users to provision only smaller instances. Whereas Horizontal Scaling by contrast, divides the huge data sets and distributes over multiple machines. Each individual server is a shard or an independent database and collectively the shards make up a single database.

Continue reading

Read More

Indexing in MongoDB

What is indexing?

Indexes provide high performance read operations for frequently used queries. For example Index in books it makes us to find the pages easily.



Indexes support the efficient execution of queries in MongoDB. With index, MongoDB will scan only less documents in your collection. But without index it scans all the data in your documents and it takes so much time.

Index is special data structure that uses B-tree algorithm. Indexes in MongoDB are similar to the indexes in other database system like mysql,oracle etc.MongoDB defines indexes at the collection level and supports indexes on any field of the documents. MongoDB can use the index to limit the number of documents
Continue reading

Read More