Instructor: So, there are two types
of ElastiCache replication you can have for Redis,
and we need to know them both.
So, the first one is called cluster mode disabled.
And in this case,
you have one primary node,
and up to five replicas for your node.
So, this is for Redis,
and so, we have one shard.
So, all your data is in this shard.
We'll have one primary cache node.
And then, we can optionally set up
up to five cache replicas.
So, from zero to five replica nodes.
The idea is
that when you have a primary node and some replicas,
in case of the failure of the primary node,
then the replicas can take over.
So, the replication is asynchronous between the caches.
And the primary node will be used for read and writes.
While the other nodes are going to be read-only.
So, on top of disaster recovery,
you can also scale your read capability
in ElastiCache for Redis by enabling read replicas.
So, you have one shard,
that means that all the nodes will have all the data
in your Redis cluster.
The idea here is that you're guarding against data loss,
if there is a node failure.
And you can also enable multi-AZ.
It is enabled by default,
by the way, in case you won't have multi-AZ failover.
So again, this is helpful for multi-AZ,
and also, for scaling the read performance
of your ElastiCache cluster.
Now, there is a second mode,
and this is with cluster mode enabled.
And in this mode,
the data is going to be partitioned across many shards.
Which is helpful if you want to scale your writes.
So, let's have a look in the second.
So, we have shard one,
and shard two or three,
or shard N.
And the idea is that the data is going
to be partially on shard one,
partially on shard two,
all the way up to shard N.
So, it's going to be divided across all your shards.
Now, each shard will work just as what we saw before,
wherein cluster mode was disabled.
I mean, we can have one primary node,
and up to five replica nodes.
So, the data is replicated and you set up the number
of replicas equally across all the shards, okay?
There's also multi-AZ capability.
It's on by default.
And so, you can have,
again, failover between your primary node
and your replica nodes
in case of an availability of failure.
And you get up to 500 nodes per cluster.
That means that if you don't set up any replicas,
you have 500 shards with a single master.
But if you are setting up replication,
for example, you want one master and one replica,
then you get 250 shards.
And if you want to have,
say, five replicas in one master,
you get 83 shards maximum.
So, the idea here is
that you are really interested into sharding your data
when you want to enable a cluster mode.
That means again,
that you want to scale your writes,
and that the data is going to be partitioned.
That means data will live
across many different shards, okay?
So, this is the main difference
when you have cluster mode enabled
or cluster mode disabled for ElastiCache.
So, that's it.
Just this thing to know going into the exam.
You can come up on one question.
I hope you liked this lecture.
And I will see you in the next lecture.