Sharding Components
13K views
Oct 24, 2024
Sharding Components
View Video Transcript
0:00
In this video we are explaining sharding components
0:04
So what are the main components of this sharding? So what is sharding
0:09
The following diagram shows the sharding in MongoDB using sharded cluster. So now we can find that here we are having some set of shirts are there
0:19
So two or more such shirts will be there in the respective shirt cluster
0:25
And we know that in each and every shard we are having the replica set
0:28
Replica set means multiple MongoD applications or instances will be running on the same
0:35
data set and that is known as a replica set and out of all this MongoDi instances
0:41
one instance will be the respective primary and rest of the instances will be the secondary nodes
0:48
So only one primary node and multiple secondary nodes will be there in one replica set
0:54
In this way you can have multiple such replica sets are there in the shared cluster
0:58
Now, this is the application server from where multiple applications are running and those applications are generating queries
1:07
And these are known as the query routers You can find that we are having multiple such query routers two or more query routers are there Now why such more query routers Because when multiple applications are generating huge number of queries at the same instance of time
1:24
so to do the load sharing, we can have two or more query routers are there
1:30
And these query routers are nothing but Mongo's instances. So, we are having the application servers and they're generating multiple different queries
1:38
to get satisfied from this MongoDB and that's why we're having multiple query routers
1:44
depending upon the number of queries or the density of the queries getting generated at that
1:49
instant of time we can go on increasing the number of query routers and this query routers
1:56
are nothing but we're having the Mongo's instances are there so Mongo's means we know
2:01
that it is the client it is a client process okay now we're having this one that is the
2:08
three config servers. We're having three config servers, exactly three. There's a config server
2:13
another config server, and another config server. These config servers are actually containing
2:18
the metadata, that is the data about data. That means, how this data have got mapped onto this
2:24
shared cluster So this is the config servers are there These queries will take the help of this config servers to get the information to get the metadata so that the query can get executed
2:36
on this shared cluster. So, there is the basic architecture and we have defined what is a sharding
2:44
Now, the components of the sharding components are, first one is the shards, and the shards
2:50
are used to store data, they provide high availability and data consistency
2:56
We know that in a same shirt where having multiple shirts will be there, they are nothing
3:01
but the replica sets, one primary node and multiple secondary nodes are there
3:06
And these secondary nodes will contain the replica of the data so that it enhance the availability
3:14
of the data. In production environment, each shirt is a separate replica set as I have discussed
3:20
Next one is the config servers. You know that in the previous diagram we are having three config servers are there
3:28
So config servers stored the clusters metadata and these data contains a mapping of the
3:34
cluster data set to the shirts. How the data has got mapped onto the shirts So that information that metadata will be kept in this config servers The query routers uses this metadata to target operations to specific shards
3:51
So, these query routers will access this config servers data, that is a metadata, and accordingly
3:56
it knows that on which shared you should execute the respective query
4:02
So in production environment, sharded clusters have exactly three config servers. In the previous diagram also, we have shown you this
4:09
that we are having three config servers. Next, we are considering this query routers
4:16
Query routers are basically Mongo instances and interface with the client applications
4:22
and direct operations to the appropriate shard. So in the diagram also we have seen that this particular query routers, they are connected
4:30
with this application servers and they are also communicating with these shirts after
4:36
getting the required information from the config servers. When these particular queries will be coming in many number of, that means when the query
4:44
will be in large number of, then we can have multiple such query routers to shear the load
4:53
So we are having this one. So the query router processes and targets the operation to the shorts and then return
#Data Management
#Other
#Programming