Microsoft SQL Server Certification Course
- 6k Enrolled Learners
- Weekend
- Live Class
One can directly connect to Mongod either using the application driver or Mongo client. Other option is the cluster that has to be built. Mongod can work as a single node of the cluster. In that case, one can connect the Mongod from your Mongos and it will act between the app driver or Mongo client or Mongod.
From the application driver or Mongo client, one can connect to Mongos, and Mongos will connect internally to the Mongod. In the development environment, there is only one node. If there are multiple nodes from the application driver, connecting to multiple nodes is not required. You have to connect only to Mongos and they will connect to multiple nodes and collect the data. For that Mongos takes the help of a configuration database which is called Configdb. Mongos is a query router which acts between the Mongo and Mongod cluster. Config database actually contains the meta data which is kept in the cluster or node.
In the above image, one node is a shard cluster. There are multiple clusters, where Mongos is one of the interface and it acts as a query router. From the application driver or from the Mongo client, instead of connecting to multiple nodes, connect to the Mongos and they will do the query distribution. Mongos takes help of the configuration database and contains the Meta data of this cluster.
In the productions scenario,there are multiple Mongos and above the Mongos there is generally a load balancer. It’s either a HTDP load balancer or a hardware load balancer, so it has a client affinity to connect all the Mongos. From your application driver you connect to multiple Mongos using that load balancer. All the different Mongos work similarly.
Replication works inside the boxes in the image. For instance, inside the shard 1 column, there is a configured replication mechanism and this box contains 256 GB data. It is called the primary member of this shard. The other two members are called as secondary. A shard is not a single Mongod process, but it should be a combo of Mongod process which is a replica set.
Got a question for us? Mention them in the comments section and we will get back to you.
Related Posts:
Course Name | Date | Details |
---|---|---|
MongoDB Certification Training Course | Class Starts on 28th December,2024 28th December SAT&SUN (Weekend Batch) | View Details |
edureka.co
Can you throw some light on how to secure a Mongo Cluster..
Hi Jatin, there are different way we can can secure Mongo DB cluster.
Enable Authentication in a Sharded Cluster.
Deploy Replica Set and Configure Authentication and authorizationConfigure a replica set that has authentication enabled.
When authentication is enabled on a sharded cluster, every client that accesses the cluster must provide credentials. This includes MongoDB instances that access each other within the cluster.
To enable authentication on a sharded cluster, you must enable authentication individually on each component of the cluster. This means enabling authentication on each mongos and each mongod, including each config server, and all members of a shard’s replica set.
Authentication requires an authentication mechanism and, in most cases, a key file. The content of the key file must be the same on all cluster members.
Deploy Replica Set and Configure Authentication and Authorization
Authentication is the process of verifying the identity of a client. When access control, i.e. authorization, is enabled, MongoDB requires all clients to authenticate themselves first in order to determine the access for the client.
Authentication and authorization are closely connected, authentication is distinct from authorization. Authentication verifies the identity of a user; authorization determines the verified user’s access to resources and operations.
MongoDB supports a number of authentication mechanisms that clients can use to verify their identity. These mechanisms allow MongoDB to integrate into your existing authentication system.
MongoDB can also require members of replica sets and sharded clusters to authenticate their membership to their respective replica set or sharded cluster.
Authentication Mechanisms :
MongoDB’s default authentication method is achallenge and response mechanism.
Previously, MongoDB used MongoDB Challenge and Response (MONGODB-CR) as the default.
MongoDB also supports x509 certificate authentication, LDAP proxy authentication, and Kerberos authentication.
Hope this helps!!