Replication Sets and Its Criteria
Watch more Videos at https://www.tutorialspoint.com/videotutorials/index.htm
Lecture By: Mr. Arnab Chakraborty, Tutorials Point India Private Limited
Show More Show Less View Video Transcript
0:00
In this video we are discussing a very important concept that is a replica sets and
0:05
its criteria. Now what is a replica set? A replica set is actually collection of multiple
0:13
MongoD applications who are working on the same dataset. So, replica set is nothing
0:20
but collection of multiple MongoD applications who are running on the same data set. Out of
0:28
these multiple MongoD applications, one application will be treated as the primary and rest of
0:34
them will be treated as the secondary. Read and write operations will be at first will be landed
0:39
at the primary MongoD application and then replications will be done on the secondary
0:45
but sometimes some read operations can also directly access the secondary MongoD. So, let us go
0:52
for some further discussions with diagrams regarding the topic that is a replica sets and it
0:58
criteria. So, here we are having one diagram. The replica set is basically a group of MongoD
1:05
applications that work on same dataset In a replica set there is only one primary MongoD instance and others are secondary So only one primary and multiple secondary nodes will be there
1:20
The primary instance takes the read-write requests from the client and it sends the
1:27
modification details to the respective secondary instances. So just consider this diagram
1:34
Here we are having the client application running. Through this driver, the read-write requests or the option
1:39
will be done with the primary MongoD instance and this primary MongoD instance will
1:46
put the replication details to the secondary MongoD instances. And what about the modifications, updations or deletions, whatever is taking place due to the
1:56
purpose of this read-write operations, then though that modifications are to be reflected or
2:02
to be conveyed to these secondary MongoD instances. So only one primary instance and more than one
2:09
at least one or more than one secondary instances will be there and that is known as the replica set
2:17
what are the features of the replica set a replica set is a collection of n different nodes and the number of n can be anything from two three and so on so at least 2 nodes must be there And we can have the 3 nodes 4 nodes and so on So replica set is nothing but a collection of n number of different nodes
2:40
Among these n nodes, only one node will be the primary instance, and rest n-manus 1 nodes
2:46
will be for the second instance. For the instances of the replica set, read and write operations goes to the primary node
2:53
you can easily find that these read-right operations are going to the primary node and then
2:59
sometimes the read operations only read not right only read operations may perform on the
3:04
secondary nodes also but right operations must be performed on the primary node only so here
3:11
we're having the restrictions that read and write will be done on the primary sometimes only read
3:17
operations can directly access the secondary instances just consider this respective we can find that we're having multiple MongoD applications are running here and you can
3:29
find that only one is primary and rest of them are secondary. So a cluster of N nodes
3:35
this is a cluster of N nodes are there Any one node can be primary So that is no priority Any one of the nodes can be primary All right operations goes to the primary as we have mentioned earlier Then automatically failover
3:50
Automatic failover means what? If the primary nodes goes down, then any one of the rest secondary nodes will be treated
3:56
as a primary node. So, election will take place so that the respective secondary node will be treated as a primary
4:03
node after failure of the current primary node. So automatic failover. next one is automatic recovery and next one is consensus election of primary so in
4:15
this way the things will take place if the primary node goes down the process
4:23
selects another node as a primary to overcome the problem so out of the rest
4:27
secondary nodes one of the nodes will be selected as a primary this process are
4:32
done automatically so MongoDB has automatic fail over and recovery mechanism. The MongoD will choose the primary node from the secondary nodes by an
4:43
election mechanism. So, the as in the way in which we select our ministers, so in the same
4:49
way out of the secondary nodes, one of the nodes will be treated as a, will be selected
4:54
as a primary through this election mechanism. When the primary node goes down, the
#Programming

