Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

While I was looking into the MongoDB documentation, I found two different terms mongod and mongos.

While starting the server, I am using ./mongod --dbpath <path to mongodb> and I am running ./mongo to connect to the server.

Can someone please clarify the differences between these two terms.

3 Answers

0 votes
by (106k points)

The difference between mongod and mongoose is as follows: 

mongod is the daemon, mongo is the client, mongos is the 'MongoDB Shard Utility'. Take a look at man mongos.

0 votes
by (107k points)

Mongos is the MongoDB Shard Utility which is considered to be the controller and query router for sharded clusters. Sharding helps in partitioning the data-set into discrete parts.

Mongod is the primary daemon method for the MongoDB system. It helps in handling the data requests, managing the data access, and performing background management operations.

0 votes
by (1.7k points)

In MongoDB, there are mongod and mongos, that are two totally different objects.

- `mongod` - the main server process, commonly also known as the Mongo Daemon. This daemon performs storage and queries data handling, even carries out all the actions of a database. Thus, launching MongoDB with `/./mongod --dbpath <path to mongodb>`, you start one run of the instance of the database server listening for incoming requests and connections.

- `mongos`: This term refers to Mongo Shard Router. The application is used with a sharded cluster. It provides for the role of being a query router. It routes requests by the client to proper instances of `mongod`, which hold the related data. Clients do not need to connect directly to servers running `mongod`, but instead connect to instances of `mongos`.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
0 votes
2 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...