1
00:00:02,960 --> 00:00:09,940
So in this session we are going to learn about setting up Cluster.  In this example I'm going

2
00:00:09,940 --> 00:00:17,200
to take 3 Nodes.  So Node 1,  which is going to be Master node and then there are 2 more Nodes, which are

3
00:00:17,200 --> 00:00:18,990
going to be Slave Nodes.

4
00:00:19,480 --> 00:00:24,990
So in total we have 3 nodes or 3 Servers.  So IP address or Server 1

5
00:00:25,030 --> 00:00:34,710
is 10.128.0.2 and Host name is itpanther01 and then we have Slave Nodes, which is IP

6
00:00:34,710 --> 00:00:43,710
address is 10.128.0.4,  Host name is itpanther02 and then the third Node is 10.128.0.5

7
00:00:43,900 --> 00:00:52,200
and Host name is itpanther03.  So initially when we are going to set up the Cluster. First Node is

8
00:00:52,200 --> 00:00:58,500
going to be Master and then when Master is going down then one of the Slave Nodes is going to be

9
00:00:58,500 --> 00:01:03,320
promoted to Master and  this thing is going to be taken care by Sentinel.

10
00:01:04,210 --> 00:01:04,540
Okay.

11
00:01:04,560 --> 00:01:11,620
So we are going to set up Redis and plus Sentinel on each of these Nodes.

12
00:01:21,740 --> 00:01:30,240
So Sentinel is already bundled with the software,  which you download,  when you download Redis. So if

13
00:01:30,240 --> 00:01:37,650
you remember in our first example,  I had already  downloaded the Software.  So I have that software and then

14
00:01:37,650 --> 00:01:46,970
we are going to extract this software and we will go on to configure.  So before we start configuration.

15
00:01:46,970 --> 00:01:51,200
Just wanted to verify all the IP addresses,  which we have shown here.

16
00:01:51,200 --> 00:01:53,230
So these are the same thing which we have here.

17
00:01:54,020 --> 00:02:00,740
So let me clear the screen and let's begin with verifying the Host name.

18
00:02:03,410 --> 00:02:12,120
So you can verify that first server is itpanther01 and this is the IP address and then I'm going to use

19
00:02:12,180 --> 00:02:16,170
ssh command  to log in to Server or Slave Nodes.

20
00:02:34,840 --> 00:02:40,720
If you use Host name,  it is going to give you the host name of the Server. If you use Host name  -i

21
00:02:40,750 --> 00:02:42,940
It is going to show you the IP address.

22
00:02:43,390 --> 00:02:45,220
So this is one of our Slave Nodes.

23
00:02:49,500 --> 00:02:53,870
and now I'm going to log in to Second Slave Node

24
00:03:01,450 --> 00:03:01,760
okay.

25
00:03:01,790 --> 00:03:05,550
So these are the servers,  which we have and we are able to log into all the servers.

26
00:03:08,530 --> 00:03:14,710
Now also just to show you that initially we do not have any, you know, software available in any of

27
00:03:14,710 --> 00:03:15,480
the Slave Nodes.

28
00:03:15,880 --> 00:03:21,670
So this is the home directory of the  Slave Node and we do not have any software available.

29
00:03:21,670 --> 00:03:29,650
So we are going to copy the software from Master Server to both the Slave Nodes.

30
00:03:29,650 --> 00:03:37,480
So I'm going to clear the screen and let me also exit because right now if you see I'm on Node 3 which

31
00:03:37,480 --> 00:03:43,570
is indicated by here itpanther03. So I will do Exit and I'll be back to server 1

32
00:03:48,110 --> 00:03:48,410
Okay.

33
00:03:48,410 --> 00:03:58,160
Now if we do ls-lrt, we see this is a software which we have downloaded and let me extract this

34
00:03:59,060 --> 00:03:59,600
software

35
00:04:14,280 --> 00:04:14,580
okay.

36
00:04:14,580 --> 00:04:22,560
Now we see Redis-stable folder.  So inside Redis-stable folder

37
00:04:22,710 --> 00:04:30,680
If you do ls-lrt again,  you will see we have Redis.conf  and also we have a

38
00:04:30,690 --> 00:04:32,690
Sentinel.conf. OK.

39
00:04:32,740 --> 00:04:40,150
So Redis.conf is going to be used for all the configuration with respect to Redis and

40
00:04:40,150 --> 00:04:44,650
Sentinel.conf,  is going to be used for all the configuration related to Sentinel

41
00:04:47,500 --> 00:04:49,990
and also if you go inside src folder

42
00:04:55,400 --> 00:04:58,940
and here if you do a ls-lrta

43
00:05:08,560 --> 00:05:12,450
OK initially if you do ls-lrta, you will not see.

44
00:05:12,930 --> 00:05:19,590
you know, Redis-server or Redis-Sentinel utility because this is just the uncompiled

45
00:05:19,580 --> 00:05:20,020
version.

46
00:05:27,310 --> 00:05:29,170
So first we need to compile this.

47
00:05:34,540 --> 00:05:41,720
So right now we are in  Redis-stable  directory.  Let me clear the screen and this is the position

48
00:05:41,790 --> 00:05:43,340
where we are right now.

49
00:05:43,370 --> 00:05:45,980
So we are  Redis-stable folder

50
00:05:46,430 --> 00:05:54,760
And here if you remember,  to make the, to compile this. We need to run Make command.

51
00:05:54,880 --> 00:05:58,520
So run Make command and hit enter.

52
00:05:58,650 --> 00:06:04,530
It is going to take a couple of minutes because it is going to prepare the binaries,  which we are going

53
00:06:04,530 --> 00:06:09,320
to use to run a Sentinel and also Redis server.

54
00:06:32,050 --> 00:06:34,240
So whatever setup we are going to do.

55
00:06:34,240 --> 00:06:36,590
Now it is going to be a production like setup.

56
00:06:37,660 --> 00:06:37,900
OK.

57
00:06:37,900 --> 00:06:40,480
The same thing you can follow in the Production Environment.

58
00:06:57,770 --> 00:07:04,790
So usually what I do is,  I compile the software at one of the  servers and then we do not need to do the

59
00:07:04,790 --> 00:07:07,310
same activity on other servers.

60
00:07:07,310 --> 00:07:10,940
We can just copy paste the  same software.

61
00:07:11,000 --> 00:07:11,270
OK.

62
00:07:11,290 --> 00:07:13,070
which is compiled one.

63
00:07:13,100 --> 00:07:23,250
So now you see it is already,  the software is compiled and we  would have Binaries now.  Lets do

64
00:07:23,320 --> 00:07:31,500
ls-lrt and now if we go inside src folder again and do ls-lrt. This time we can see

65
00:07:31,500 --> 00:07:36,180
we have Redis-server and also we have a Redis-Sentinel.

66
00:07:36,360 --> 00:07:42,390
So Redis-server is  going to be used to start Redis server and also Redis-Sentinel will

67
00:07:42,390 --> 00:07:43,970
be used to start Sentinel.

68
00:07:46,940 --> 00:07:51,050
and both of these you know, utilities accept configuration file.

69
00:07:52,010 --> 00:07:58,520
So Redis-server,  we are going to pass Redis.conf file while starting Redis server and

70
00:07:59,090 --> 00:08:07,130
to Redis-Sentinel, we are going to pass Sentinel.conf file.  So that is why it is important

71
00:08:07,130 --> 00:08:12,260
we set up a Configuration File correctly before starting

72
00:08:12,260 --> 00:08:14,210
both of these services.

73
00:08:14,420 --> 00:08:19,130
So I am going one level back and if we do ls-lrt, here we have

74
00:08:22,050 --> 00:08:24,400
Redis.conf and Sentinel.conf.

75
00:08:24,640 --> 00:08:29,530
So let's start by setting up configuration for Redis.conf

76
00:08:30,500 --> 00:08:35,060
And remember currently we are on the Master Node. So whatever configuration we are doing, it is for the

77
00:08:35,060 --> 00:08:35,690
Master Node.

78
00:08:41,130 --> 00:08:43,920
So I'm opening Redis.conf in VI Editor

79
00:08:52,630 --> 00:08:59,670
and now if you scroll down, first thing we need to change is the buying address.

80
00:09:00,240 --> 00:09:00,490
Okay.

81
00:09:00,490 --> 00:09:04,150
So by default it is showing 127.0.0.1

82
00:09:05,170 --> 00:09:12,460
So this one we need to change to the actual IP address of the server, on which Redis instance is

83
00:09:12,460 --> 00:09:14,080
going to run.

84
00:09:14,080 --> 00:09:18,850
So this is Master Node. So for this one, we need to put the IP address of the Master Node.

85
00:09:25,880 --> 00:09:30,170
So here I have made the change and put the IP address of the Master Node

86
00:09:44,270 --> 00:09:48,330
and the second thing we can also make change in the  log file. So a Log file

87
00:09:48,560 --> 00:09:51,820
Usually I keep at /tmp directory.

88
00:09:51,860 --> 00:09:56,690
So I'm going to give location of /tmp/redis.log

89
00:09:59,630 --> 00:10:06,790
So on the Master Node, under the /tmp directory.  There is going to be a file created Redis.log

90
00:10:06,790 --> 00:10:15,100
that is going to hold all the logs related to Redis database and if you scroll further down,

91
00:10:15,110 --> 00:10:16,070
Now we need to

92
00:10:23,840 --> 00:10:24,110
okay.

93
00:10:24,120 --> 00:10:33,440
So now you can search  Replica of,  but make sure that on the Master Server, you do not make any changes

94
00:10:33,440 --> 00:10:39,310
here in the Replica of. In  the Master Server,  we don't need to make any changes here.

95
00:10:39,350 --> 00:10:46,930
And on the Slave Nodes, we are going to make changes here and going to update the Master IP address and

96
00:10:46,930 --> 00:10:47,810
Port Number here.

97
00:10:48,190 --> 00:10:48,520
Okay.

98
00:10:48,520 --> 00:10:49,000
So

99
00:10:52,590 --> 00:10:54,540
for now on the Master Node, we are done.

100
00:10:54,540 --> 00:10:56,490
We don't need to make any other changes here.

101
00:10:58,350 --> 00:11:05,050
So save and Exit and now let's make changes in the Sentinel.conf File.

102
00:11:08,040 --> 00:11:08,550
so here

103
00:11:08,550 --> 00:11:16,740
also first thing you need to do is, change this Bind Address and by default it is, if it is commented

104
00:11:16,760 --> 00:11:17,960
you can uncomment

105
00:11:21,480 --> 00:11:25,690
and remove whatever default IP addresses are given.

106
00:11:25,700 --> 00:11:32,500
And since we are making Configuration on muster.

107
00:11:33,140 --> 00:11:36,260
So here we need to be the IP address of the Master.

108
00:11:48,070 --> 00:11:48,380
okay.

109
00:11:48,410 --> 00:11:54,320
So the IP address for that is 10.128.0.2

110
00:11:54,390 --> 00:11:55,740
This is a very important step.

111
00:11:55,830 --> 00:11:59,400
So always make sure we have the correct IP address updated here.

112
00:11:59,940 --> 00:12:02,890
Otherwise your Redis server or

113
00:12:03,000 --> 00:12:10,050
and also you're Redis Sentinel may not be able to communicate with each other with Slave Nodes.

114
00:12:10,170 --> 00:12:10,460
Okay.

115
00:12:10,470 --> 00:12:17,760
So that is going to be very complicated, once you end up into issues and it is going to be very difficult

116
00:12:17,760 --> 00:12:21,790
to troubleshoot,  especially when you are doing it for the first time.

117
00:12:21,840 --> 00:12:25,650
So always make sure you have the correct IP address updated in the Bind

118
00:12:31,230 --> 00:12:37,480
and for Sentinel,  I'm going to change the log file to /tmp/sentinel.log

119
00:12:41,720 --> 00:12:50,270
If you have seen, we have not made any changes in the port. So default Port for Redis is 6 3 7 9 and

120
00:12:50,270 --> 00:12:55,240
for Sentinel it is 2 6 3 7 9.  Okay.

121
00:12:55,270 --> 00:12:56,590
So this is going to be same

122
00:13:00,900 --> 00:13:01,830
on all the nodes

123
00:13:08,820 --> 00:13:09,110
okay.

124
00:13:09,120 --> 00:13:13,200
Now we have made the basic changes which was required on the

125
00:13:16,660 --> 00:13:19,140
Master Node.

126
00:13:19,230 --> 00:13:20,580
I think I'm missing one thing here.

127
00:13:20,610 --> 00:13:22,730
So let's go to Sentinel.conf file

128
00:13:22,800 --> 00:13:30,110
again and here I think we missed one thing,  which was related to Sentinel Monitor.

129
00:13:30,270 --> 00:13:30,570
Okay.

130
00:13:30,570 --> 00:13:32,850
So this is again important thing here.

131
00:13:32,880 --> 00:13:40,100
You specify the IP address of your Master Node.

132
00:13:40,100 --> 00:13:47,910
So here we know Master node is going to be 10.128.0.2 and this is the Master Node which

133
00:13:47,910 --> 00:13:53,850
is going to be the Initial Master Node.  After that Sentinel is going to decide on its own that and

134
00:13:54,060 --> 00:14:03,640
Sentinel is going to elect a new master in case existing master goes down and after the IP address we

135
00:14:03,640 --> 00:14:04,870
have Port number.

136
00:14:05,170 --> 00:14:11,050
So as we know,  we have not made any changes and default Redis runs on 6 3 7 9.

137
00:14:11,080 --> 00:14:17,110
So the  same port is given here as well and this name My Master Name is the logical name.  If you want to

138
00:14:17,110 --> 00:14:19,200
change it, it can be changed as well.

139
00:14:19,300 --> 00:14:21,070
In my case I'm not going to change it.

140
00:14:23,880 --> 00:14:28,440
However, when you are doing the same thing in the Production, based on the Organization Naming Structure

141
00:14:28,440 --> 00:14:30,690
or Naming Standards, you may need to change this.

142
00:14:33,960 --> 00:14:42,670
and after the Port, we have the count of the Quorum which is set to number 2. So the count of the Quorum

143
00:14:42,740 --> 00:14:49,120
specify,  this is the minimum number of Sentinel Nodes,  which need to agree, whenever they are going to

144
00:14:49,120 --> 00:14:50,230
make any decision.

145
00:14:50,680 --> 00:14:56,460
So the decision can be that whether the Master is down or not.

146
00:14:56,550 --> 00:15:01,230
And  which of the  Slave Node, should become the new Master.

147
00:15:01,470 --> 00:15:09,770
Okay so these are the decisions which Sentinel is going to make and minimum of 2 sentinel servers

148
00:15:09,780 --> 00:15:17,520
has to agree in order to make one of the existing Slave and promoted into a Master.

149
00:15:24,940 --> 00:15:29,740
So when you make any changes here with respect to the name My Master.

150
00:15:29,740 --> 00:15:35,610
So make sure you also need to make  changes for the same name in the other lines as well.

151
00:15:35,620 --> 00:15:39,810
So this name, whatever name you give here should also be matching in the other name.

152
00:15:41,300 --> 00:15:45,560
Which you can see here, like it is set up here or here.

153
00:15:45,560 --> 00:15:51,970
In my case I have not made any changes. Okay so that's why I don't need to make any changes in the

154
00:15:51,970 --> 00:15:53,690
names.

155
00:15:53,710 --> 00:15:58,420
Now the other important thing is, here you see Sentinel down after milliseconds

156
00:16:01,300 --> 00:16:03,610
and here you specify the name of the Master Node.

157
00:16:03,640 --> 00:16:10,360
So basically here we are telling that after how many seconds Sentinel is going to say that

158
00:16:10,390 --> 00:16:17,230
Okay Master node is down and it is going to work towards promoting one of the Slave Nodes to make them

159
00:16:17,320 --> 00:16:19,480
a Master. okay.

160
00:16:19,490 --> 00:16:26,590
So by default it is set to 30000 milliseconds which is equal to 30 seconds.

161
00:16:27,160 --> 00:16:33,780
So again depend on the design  which you want to set up in the Production Environment.

162
00:16:33,780 --> 00:16:37,280
You may increase or decrease the value here.

163
00:16:37,320 --> 00:16:40,920
Right now we are just going to leave it to default which is 30 seconds

164
00:16:44,290 --> 00:16:45,970
okay so that's it here.

165
00:16:46,000 --> 00:16:47,170
Now I think we are good.

166
00:16:48,520 --> 00:16:56,700
So I have saved and exited from here. Okay so we have done the kind of basic configuration for this node.

167
00:16:56,760 --> 00:16:59,600
Now I'm going to copy the software to the other nodes.

168
00:17:02,010 --> 00:17:08,320
And also make sure once you copy the software to  other nodes,

169
00:17:09,330 --> 00:17:12,480
You need to make changes related to the IP address on the other nodes.

170
00:17:13,290 --> 00:17:15,750
Okay so let's see that.

171
00:17:15,860 --> 00:17:19,540
Let me clear the screen first and go one step back.

172
00:17:21,410 --> 00:17:24,320
So I'm going to use scp command.

173
00:17:24,320 --> 00:17:24,820
So scp command

174
00:17:24,890 --> 00:17:29,120
is used to transfer files from one server to another server.

175
00:17:29,990 --> 00:17:36,140
So in this case I want to copy this complete directory.  So that's why I have given scp -r which

176
00:17:36,140 --> 00:17:46,690
is recursive and then we need to specify the server, where we want to copy this, you know, directory or files.

177
00:17:46,720 --> 00:17:53,640
So in this case it is going to be  itpanther02, which is one of the Slave Nodes.

178
00:17:53,680 --> 00:17:59,350
You can also specify the IP address but usually it is easier to specify the Host name

179
00:18:04,250 --> 00:18:11,560
and then this ~/  is actually specifying that, we need to copy this Redis-stable

180
00:18:11,570 --> 00:18:12,800
to the home directory

181
00:18:16,690 --> 00:18:17,000
okay.

182
00:18:17,020 --> 00:18:18,130
So on this Server

183
00:18:20,810 --> 00:18:24,730
Redis Admin's home  directory. This Redis-stable is going to get copied.

184
00:18:25,290 --> 00:18:26,630
Okay so let's hit enter.

185
00:18:32,820 --> 00:18:33,160
okay.

186
00:18:33,160 --> 00:18:40,770
So yeah we missed to specify the directory,  which we want to copy.  So that's why we got the error

187
00:18:40,960 --> 00:18:48,780
So this is the correct syntax. So use give scp -r  the directory, which you want

188
00:18:48,780 --> 00:18:56,850
to copy along with the sub-directories and files and then you give that Host name,  from where you want to

189
00:18:56,850 --> 00:19:04,780
copy and also if you want to copy under any other user,  you can also specify that User Name here.

190
00:19:05,110 --> 00:19:13,470
Whatever User Name you want to copy it to.  If you do not specify any user here, on the server where you

191
00:19:13,470 --> 00:19:17,820
are trying to copy.  This software it is going to copy the same user name.

192
00:19:18,020 --> 00:19:18,280
Okay.

193
00:19:18,300 --> 00:19:24,300
So in this case I already have Redis Admin user name created on all the Slave nodes as well.  So

194
00:19:24,300 --> 00:19:31,700
we may not need to specify the User Name here.  Again so the fundamental here is, that we are copying this

195
00:19:31,780 --> 00:19:39,290
Redis -stable software from Master Nodes to  Slave Nodes. You may use WinSCP or any other

196
00:19:39,290 --> 00:19:42,300
mechanism to copy this software from one server to another.

197
00:19:42,440 --> 00:19:46,700
So I'm just using SCP here and let's hit enter.

198
00:19:49,750 --> 00:19:54,660
Now the File Copy is in progress and File Copy has been completed.

199
00:19:58,710 --> 00:20:05,140
Now let's also copy this software on Third Node, which is itpanther03. So I have changed  the host name

200
00:20:05,160 --> 00:20:09,210
here, remaining all. Everything remains the same.

201
00:20:09,210 --> 00:20:09,750
Hit Enter.

202
00:20:17,770 --> 00:20:20,770
Okay so now software has been copied.

203
00:20:20,770 --> 00:20:27,000
Now we will log in one by one to the Slave Nodes and also we will correct the configuration changes

204
00:20:27,010 --> 00:20:28,960
which we have set up for Master Node.

205
00:20:29,590 --> 00:20:32,240
Okay so Master Node is done.

206
00:20:32,290 --> 00:20:36,460
Now let's log into Slave Node, which is itpanther02

207
00:20:41,000 --> 00:20:47,030
and here if I do a ll or ls-lrt. You can do whatever command you like.

208
00:20:47,030 --> 00:20:51,260
And now we can see, we have Redis-stable folder  here.

209
00:20:51,260 --> 00:20:57,940
So if we go inside Redis-stable and we open,

210
00:20:58,320 --> 00:21:09,040
Redis.conf. Okay the same thing whatever configuration which we have done on Master node,  has been

211
00:21:09,040 --> 00:21:10,940
copy pasted here on the other nodes.

212
00:21:11,710 --> 00:21:16,270
However, as we know this is itpanther02

213
00:21:16,270 --> 00:21:19,500
So here this IP address is going to be different.

214
00:21:19,560 --> 00:21:19,830
Okay.

215
00:21:19,840 --> 00:21:23,180
So in the Bind, make sure you have the correct IP address.

216
00:21:23,350 --> 00:21:28,160
So this IP address should be,  the IP address on which you are going to run this

217
00:21:28,210 --> 00:21:29,730
Redis instance.

218
00:21:29,770 --> 00:21:30,030
Okay.

219
00:21:30,070 --> 00:21:38,200
So in this case it is going to be 10.128.0.4, because this is server itpanther02

220
00:21:43,750 --> 00:21:50,890
and the benefit we got from making the Configuration, Basic Configuration,  initially and then copy pasting

221
00:21:50,890 --> 00:21:58,450
on other node is, that here we will, we see we already have a Log File specified.  We do not need to, you know,

222
00:21:58,540 --> 00:22:00,830
make the same changes here as well.

223
00:22:01,810 --> 00:22:08,800
So the only change we needed to make was, related to bind and the other thing is, we also need to make

224
00:22:08,800 --> 00:22:12,010
a change in the  replica of.

225
00:22:12,040 --> 00:22:17,130
So on the Master Node,  we have not touched this section.

226
00:22:17,570 --> 00:22:23,550
However when you are working on the Slave Node, you need to provide the Master IP address, in the

227
00:22:23,550 --> 00:22:26,510
Replica of  section.

228
00:22:26,680 --> 00:22:27,480
Okay.

229
00:22:27,790 --> 00:22:36,280
So here we know our Master is running on, 10.128.0.2 and also it is running on default port which

230
00:22:36,280 --> 00:22:39,420
is 6 3 7 9

231
00:22:44,470 --> 00:22:44,770
okay.

232
00:22:44,800 --> 00:22:46,080
So that's it.

233
00:22:46,090 --> 00:22:52,840
We can now save it and exit and now let's make changes in Sentinel.conf

234
00:22:57,160 --> 00:22:59,150
Again first thing is you need to change

235
00:22:59,160 --> 00:23:08,920
Bind Address. Since this software is going to run on server 4. So I have changed it  to, change the IP address

236
00:23:08,920 --> 00:23:12,710
accordingly and Log File,

237
00:23:12,720 --> 00:23:19,270
we don't need to make any changes. So on this server again Log is going to be stored under /tmp

238
00:23:19,270 --> 00:23:28,410
So now we have kind of standard. So across all the nodes including Master and the Slave Nodes, Redis

239
00:23:28,420 --> 00:23:38,730
Logs and Sentinel Logs are going to be stored inside  /tmp directory.

240
00:23:38,800 --> 00:23:46,580
Also if you now see, in Sentinel we already have, you know correct configuration because whatever we did

241
00:23:46,580 --> 00:23:50,670
in the case of Master, the same thing has to be done on the other node.

242
00:23:50,780 --> 00:23:53,280
So we do not need to make any changes here.

243
00:23:59,530 --> 00:23:59,840
Okay.

244
00:23:59,870 --> 00:24:07,580
So the only change which we have made in Sentinel.conf File   is, we have changed the Bind Address and also

245
00:24:07,580 --> 00:24:09,890
provided  the correct IP address of this server.

246
00:24:10,440 --> 00:24:18,600
And now we can save and exit. Okay so now we have done the configuration on Slave Node as well.

247
00:24:18,730 --> 00:24:21,180
Now let's move on to the second Slave Node

248
00:24:25,720 --> 00:24:36,380
So I'm going to do ssh  itpanther03 and now if we do ll, we can see we have the directory

249
00:24:36,380 --> 00:24:36,620
here.

250
00:24:36,620 --> 00:24:38,840
Let's go on to this directory.

251
00:24:42,110 --> 00:24:43,130
and let's

252
00:24:43,300 --> 00:24:45,040
Make the changes in Redis.conf

253
00:24:52,720 --> 00:24:58,810
So here in the bind, please provide the correct IP address of this server which is, in my case going to

254
00:24:58,810 --> 00:25:05,370
be 10.128.0. 5 because this is server 3

255
00:25:10,720 --> 00:25:16,360
Oh, I'm sorry.  It has to be changed to 5. Ok

256
00:25:16,380 --> 00:25:17,540
You can see here.

257
00:25:18,870 --> 00:25:23,580
So this is the Host name and this is IP address.

258
00:25:23,580 --> 00:25:25,380
So the same I have copy pasted here.

259
00:25:31,760 --> 00:25:33,800
Log file is going to remain same.

260
00:25:33,800 --> 00:25:35,450
We don't want to make any changes here.

261
00:25:37,710 --> 00:25:43,520
And now we need to make changes near the replica of section.

262
00:25:43,520 --> 00:25:45,110
So here I'm going to uncomment

263
00:25:48,690 --> 00:25:57,810
and let's provide the master IP address which is 10.128.0. 2 and the port on which master is running

264
00:25:58,440 --> 00:26:05,330
is the default port which is 6 3 7 9.Okay.

265
00:26:05,330 --> 00:26:05,900
So that's it.

266
00:26:05,960 --> 00:26:12,030
Now we can save and exit and now let's make changes in
Sentinel.conf

267
00:26:13,920 --> 00:26:18,720
Here the only change,  which we need to make is,  we need to change this Bind Address to point to the correct

268
00:26:18,720 --> 00:26:19,430
IP address.

269
00:26:19,620 --> 00:26:25,020
So it is going to be 10.128.0. 5. Save and exit

270
00:26:28,460 --> 00:26:28,760
okay.

271
00:26:28,780 --> 00:26:30,880
So from configuration wise we are good.

272
00:26:30,880 --> 00:26:32,880
We have done all the configuration.

273
00:26:33,190 --> 00:26:34,500
So just a quick recap.

274
00:26:34,540 --> 00:26:37,190
We have downloaded the software on Node 1.

275
00:26:37,270 --> 00:26:45,950
Then we did some initial configuration on Node 1, Redis.conf and Sentinel.conf and then

276
00:26:45,950 --> 00:26:54,970
we copy the same software to other Slave Node and we also change the Bind Address to point to the correct

277
00:26:54,970 --> 00:27:00,950
IP address on both the configuration file,  which is Redis.conf and Sentinel.conf

278
00:27:00,970 --> 00:27:09,270
Now we are going to start Redis  on all the nodes. So let me go to Node 1

279
00:27:17,290 --> 00:27:18,600
OK let me clear the screen.

280
00:27:18,700 --> 00:27:22,260
So Host name and Host name-i

281
00:27:22,990 --> 00:27:25,210
So you can see right now we are on the Master Node

282
00:27:28,840 --> 00:27:34,040
and we are here at this directory /home/redisadmin.

283
00:27:34,040 --> 00:27:35,750
So let's start Redis Server

284
00:27:39,310 --> 00:27:42,170
by using command Redis-server and then

285
00:27:45,020 --> 00:27:48,320
we need to pass the Redis.conf file here.

286
00:27:53,230 --> 00:27:57,850
And also I will use & because I want to run this service as a background service

287
00:28:01,630 --> 00:28:02,340
so that's it.

288
00:28:02,380 --> 00:28:03,410
Hit enter.

289
00:28:04,150 --> 00:28:08,080
And also now we can run  Sentinel by using Redis-sentinel

290
00:28:12,050 --> 00:28:18,790
and here we need to provide full path  of Sentinel.conf, use &

291
00:28:18,800 --> 00:28:21,900
Hit enter. Okay.

292
00:28:21,930 --> 00:28:30,660
So now if you want to see the logs of  Redis server and Redis Sentinel, you can go on to  tmp directory.

293
00:28:30,690 --> 00:28:38,880
So we know that we have stored logs at,  tmp/redis.log

294
00:28:39,430 --> 00:28:39,670
Okay.

295
00:28:39,690 --> 00:28:46,450
So Redis logs are this directory. So, I'm using tail to see the logs.

296
00:28:46,620 --> 00:28:50,780
Okay so we can see it is saying that it is Ready to accept connections.

297
00:28:50,780 --> 00:28:59,930
So seems Master has started properly and we can also verify the same  by checking for sentinel.log

298
00:29:02,540 --> 00:29:02,840
okay.

299
00:29:02,870 --> 00:29:04,890
So here also it  seems to be okay.

300
00:29:10,750 --> 00:29:17,030
So on Node 1,  we have started Redis and also Sentinel.

301
00:29:17,130 --> 00:29:19,590
Now I'm going to move on to Node 2

302
00:29:25,460 --> 00:29:32,880
and here also we will start Redis and also Sentinel.  So everything will remain the same.

303
00:29:43,120 --> 00:29:47,890
Just make sure when you are starting Sentinel, you use Redis-sentinel.

304
00:29:47,890 --> 00:29:49,510
Do not use Redis-server.

305
00:29:57,240 --> 00:29:57,610
okay.

306
00:29:57,620 --> 00:30:07,120
So we have started on Slave Node as well.  Let's check the logs by doing tail-f, tail space -f

307
00:30:07,880 --> 00:30:11,780
and going to /tmp/. For Redis Log

308
00:30:11,780 --> 00:30:16,980
we need to go to Redis.log

309
00:30:17,000 --> 00:30:23,630
All right so here now we see, when we started Slave node,  we could see that it is saying,  Master and Replica

310
00:30:23,660 --> 00:30:25,150
has synced.

311
00:30:25,250 --> 00:30:32,020
So basically when we started a Slave node, it was able to connect to Master node and they were Master

312
00:30:32,020 --> 00:30:41,250
and you know,  Slave  were able  to connect and Master was able to replicate all the data from Master to Slave

313
00:30:41,250 --> 00:30:41,900
node.

314
00:30:42,360 --> 00:30:44,960
So this looks fine to me.

315
00:30:45,240 --> 00:30:46,830
Now we can see the log of

316
00:30:49,820 --> 00:30:50,480
Sentinel.

317
00:30:54,980 --> 00:31:04,240
So here also we can see that it has added the child node,  which is slave node to

318
00:31:04,260 --> 00:31:05,960
10.128.0.4

319
00:31:06,010 --> 00:31:11,650
This is a node, which we started and  Sentinel has detected that one more node has been added to the

320
00:31:12,460 --> 00:31:13,290
Redis Cluster.

321
00:31:16,200 --> 00:31:17,790
OK so this also looks good.

322
00:31:25,540 --> 00:31:28,590
And now we can do the same thing on server 3.

323
00:31:28,600 --> 00:31:43,360
So I will clear the screen and let me log into Server 3, which is  itpanther03 and IP address is

324
00:31:43,360 --> 00:31:45,260
10.128.0.5

325
00:31:45,750 --> 00:31:46,070
Okay.

326
00:31:46,070 --> 00:31:48,730
And now we need to start Redis.

327
00:31:59,550 --> 00:32:01,350
now we need to start Sentinel.

328
00:32:12,660 --> 00:32:17,130
Okay just be careful when you are doing for the first time. Do it slowly.

329
00:32:17,130 --> 00:32:22,560
Especially when you are doing on the Production Environment. Okay.

330
00:32:22,580 --> 00:32:27,230
So here also we have started Redis and we have also started Sentinel. So let's see the logs.

331
00:32:36,100 --> 00:32:46,030
Okay on this note also everything seems to be okay and Master and Replica both synced and  both looks

332
00:32:46,030 --> 00:32:47,020
to be in good shape.

333
00:32:49,000 --> 00:32:51,750
Let's check the logs of Sentinel.

334
00:32:58,170 --> 00:32:58,430
okay.

335
00:32:58,450 --> 00:33:02,080
So here also we can see everything is looking okay.

336
00:33:03,490 --> 00:33:11,170
And you can see there is one entry, which is saying +Slave which means Sentinel has detected that one more Slave

337
00:33:11,220 --> 00:33:12,760
has been added to the Cluster.

338
00:33:12,790 --> 00:33:13,080
Okay.

339
00:33:13,100 --> 00:33:15,700
Which is you can verify the IP address.

340
00:33:15,700 --> 00:33:16,990
So now we have two Slaves.

341
00:33:20,760 --> 00:33:27,000
one is 10.128.0.4,  the other one is 10.128.0.5

342
00:33:30,890 --> 00:33:31,520
okay.

343
00:33:31,620 --> 00:33:42,600
So now, right now I'm still on Node 3, which is, you can verify by using Host name  -i

344
00:33:42,600 --> 00:33:51,570
you see the IP address and now to connect to Redis Client, now we need to use Redis-cli

345
00:33:51,780 --> 00:34:01,390
and you know you don't need to switch over to servers by using, Redis-cli. You can pass the

346
00:34:01,600 --> 00:34:05,750
Host name to which you want to connect to and also you can specify the Port.

347
00:34:05,800 --> 00:34:10,760
Okay so if I want to connect to Master Node, I can specify

348
00:34:10,760 --> 00:34:19,000
Redis-cli-h and IP address of the Master Node. So -h signifies Host here.

349
00:34:19,010 --> 00:34:33,380
So we know our Master is running on 10.128.0.2 and it is running on Port 6 3 7 9. So

350
00:34:33,380 --> 00:34:40,670
that's how we connect to you know, from  one of the the client, we can connect to any number of Redis

351
00:34:40,670 --> 00:34:44,200
server. We just need to provide the Host name and the correct Port number.

352
00:34:47,250 --> 00:34:55,980
So right now we are connected to Master Node and let's see since this is a new Setup, we should not have

353
00:34:55,980 --> 00:35:04,200
any data here. As we can see dbsize giving value of 0. If we do Keys * we get empty list.

354
00:35:04,200 --> 00:35:06,500
So basically right now there is nothing

355
00:35:06,830 --> 00:35:08,040
in our Redis Cluster.

356
00:35:09,690 --> 00:35:16,440
Let me exit from here and let's connect to one of the Slave Nodes. So Slave Nodes are running on Node

357
00:35:16,470 --> 00:35:17,270
4 and 5.

358
00:35:17,280 --> 00:35:23,870
So I have changed the IP address and here also we can verify the same.

359
00:35:26,430 --> 00:35:28,130
Okay we do not see any data here

360
00:35:30,980 --> 00:35:33,050
and you can verify the same one Node 5

361
00:35:41,330 --> 00:35:41,630
okay.

362
00:35:41,660 --> 00:35:43,520
So everything is good now.

363
00:35:43,520 --> 00:35:46,460
Now let's connect to Master node again.

364
00:35:46,460 --> 00:35:53,030
So I'm going to provide IP address of Master node and now we will write some data and we should be able

365
00:35:53,030 --> 00:35:57,030
to see this data on the Slave Nodes.

366
00:36:01,590 --> 00:36:03,540
So I will do L push.

367
00:36:03,540 --> 00:36:06,150
I will provide some Color values.

368
00:36:13,460 --> 00:36:20,440
Okay hit enter.  So we have a set up 5 values or we have actually written a key with 5 values.

369
00:36:21,230 --> 00:36:21,670
Okay.

370
00:36:21,690 --> 00:36:32,470
If I do L range, key name 0 -1. I see all the 5 values here on the Master Node. Now lest's connect

371
00:36:32,470 --> 00:36:39,150
to Slave Nodes and let's verify the same.  Okay whether the data has replicated or not.

372
00:36:39,150 --> 00:36:40,890
So I'm going to connect to Node 4

373
00:36:45,130 --> 00:36:45,860
and here.

374
00:36:45,870 --> 00:36:53,760
If we do L range, key name,  which is Color. Starting position is 0. Ending position is -1, which means

375
00:36:53,760 --> 00:37:00,670
it is going to give us all the value of this List and we can see on the Slave Node also,  we get

376
00:37:00,670 --> 00:37:02,860
the same output.

377
00:37:02,980 --> 00:37:04,920
Let's connect to other slave node.

378
00:37:11,510 --> 00:37:12,090
okay here

379
00:37:12,150 --> 00:37:14,180
also, we can verify.  We get the same output.

380
00:37:14,780 --> 00:37:21,180
So it means Redis cluster has been set up properly and master and slaves are in sync.

381
00:37:21,440 --> 00:37:29,690
And whatever we write to Master,  we are able to, Master is able to replicate to all the Slave Nodes.

382
00:37:29,700 --> 00:37:33,500
Now what happens when you try to write anything on the

383
00:37:33,500 --> 00:37:33,710
Slave Nodes.

384
00:37:33,730 --> 00:37:35,980
So right now we are still logged into the Slave node.

385
00:37:36,020 --> 00:37:44,420
And if I do set and some key name, let's say  Product and we specify Chair. Hit enter.

386
00:37:44,420 --> 00:37:52,560
You see we get error that It is only a Read Only Node. we cannot write any data to Slave Nodes.

387
00:37:52,560 --> 00:37:56,570
So this also proves that this is a Slave Node, which we are connected to.

388
00:37:56,790 --> 00:38:01,120
Now I'm going to exit from here.  Clear the screen.

389
00:38:01,120 --> 00:38:05,160
Now we will learn the way how to connect to Redis Sentinel.

390
00:38:06,630 --> 00:38:10,950
So for this one, you still use Redis-cli utility

391
00:38:14,120 --> 00:38:16,610
and you use -h to specify the Host name.

392
00:38:16,610 --> 00:38:22,610
Since we are running Sentinel on all the 3 nodes.  So you can connect to any of the 3 nodes by

393
00:38:22,610 --> 00:38:27,930
specifying the -h and correct Host name.

394
00:38:27,960 --> 00:38:28,210
Okay.

395
00:38:28,230 --> 00:38:37,450
So let's say we want to connect to 10.128.0.2, which is you know, the server where our Master

396
00:38:37,470 --> 00:38:38,810
Redis is running on.

397
00:38:39,060 --> 00:38:49,020
And also we need to specify the Port we are using -P and Sentinel runs on Port 2 6 3 7 9, by default.

398
00:38:49,020 --> 00:38:56,280
And we haven't made any changes.  So we can connect to Sentinel by using  Port 2 6 3 7 9.  In case you have

399
00:38:56,280 --> 00:38:57,170
made any changes.

400
00:38:57,180 --> 00:39:00,370
So you need to specify the correct Port number here.

401
00:39:00,720 --> 00:39:02,110
So hit enter.

402
00:39:02,250 --> 00:39:04,410
Now we are connected to Sentinel.

403
00:39:04,890 --> 00:39:15,030
So there are many commands related to Sentinel,  which you can use to monitor or do various other actions

404
00:39:15,720 --> 00:39:16,880
In this one we,

405
00:39:16,950 --> 00:39:23,310
since this session is all about setting up clusters.  So we are just going to stick to setting up Cluster

406
00:39:23,460 --> 00:39:26,730
and we will just use couple of commands of Sentinels.

407
00:39:27,360 --> 00:39:33,930
So here if you want to see what is, you know, information. So you use Sentinel

408
00:39:37,340 --> 00:39:44,210
space Master and specify the logical Master node. So if you remember in Redis.conf,  we had a

409
00:39:44,210 --> 00:39:48,170
name, which is called My Master and we hadn't made any changes there.

410
00:39:48,200 --> 00:39:52,840
So logical name is going to remain the same, which is going to be called My Master.

411
00:39:53,450 --> 00:39:54,890
So this is  our Cluster Name

412
00:39:57,850 --> 00:39:58,470
you know you can,

413
00:39:58,500 --> 00:40:03,440
Yeah you can take it as a Logical Cluster Name but actually it is pointing to the Master.

414
00:40:04,060 --> 00:40:04,300
Okay.

415
00:40:04,310 --> 00:40:05,350
So if you  hit enter

416
00:40:12,090 --> 00:40:16,860
Now you can see all the information, which is provided by Sentinel.

417
00:40:16,890 --> 00:40:25,900
So right now if you see, Sentinel knows that you know, name of the Master is My Master and it is running on IP

418
00:40:25,930 --> 00:40:30,820
10.128.0.2 and the port on which it is running is this

419
00:40:33,750 --> 00:40:37,130
and the runid  is also provided here.

420
00:40:37,420 --> 00:40:43,750
And the more important thing, if you scroll down, you can see on Line number 21, that we have down after

421
00:40:43,750 --> 00:40:50,730
milliseconds, which is set to 30000 milliseconds, which is equal to 30 seconds.

422
00:40:50,830 --> 00:41:00,190
And also if you look at bit down, you can see the total number of Slaves is shown as 2.  So  Sentinel

423
00:41:00,200 --> 00:41:06,510
is correctly able to  figure out, that how many Master Node or how many Slave Nodes are connected.

424
00:41:06,510 --> 00:41:11,610
So it has shown 1 Master Node at the top and it also knows that there are 2 Slave Nodes, which are

425
00:41:12,140 --> 00:41:20,700
you know, part of this Cluster and also on Line number 33, you can see it is talking well number of other

426
00:41:20,860 --> 00:41:21,660
Sentinels.

427
00:41:22,040 --> 00:41:28,400
So not only Sentinel knows that how many Master and Slave Nodes are running. This also knows how many different

428
00:41:28,940 --> 00:41:34,920
Sentinels are running. So other than this Sentinel,  it also know that there are 2 more Sentinels are

429
00:41:35,020 --> 00:41:38,420
running. Okay and number of Quorums are specified as 2

430
00:41:39,590 --> 00:41:46,250
So it means there are 2 Sentinels instances they have to agree.

431
00:41:46,430 --> 00:41:53,880
You know whenever  one of the Master is down and then they are going to elect a New Master from one

432
00:41:53,880 --> 00:41:56,960
of the existing Slaves.

433
00:41:57,020 --> 00:41:57,320
Okay

434
00:42:04,550 --> 00:42:07,430
so now let's exit from here.

435
00:42:07,460 --> 00:42:21,080
So if you see now, we are on Master node and here let's.

436
00:42:21,590 --> 00:42:21,810
Yeah.

437
00:42:21,810 --> 00:42:27,750
So what I will do now, we will shut down the Master Node services of Redis on Master node and we will

438
00:42:27,750 --> 00:42:33,570
see how Sentinel is going to detect that Master Node is down and it is going to promote a New Node,

439
00:42:34,260 --> 00:42:36,390
you know one of the Slave Nodes to the Master Node.

440
00:42:39,760 --> 00:42:42,070
So first thing is we would like to see the Logs.

441
00:42:42,160 --> 00:42:42,410
Okay.

442
00:42:42,400 --> 00:42:48,060
While this is happening. So let's log into one of the Slave Nodes.

443
00:42:58,740 --> 00:42:59,020
okay.

444
00:42:59,020 --> 00:43:03,580
This is a Slave Node and here we will open Sentinel Logs.

445
00:43:03,640 --> 00:43:10,110
So when we are shutting down services on Master node, we should be able to see the logs in the real time.

446
00:43:10,120 --> 00:43:12,320
so we know what is happening behind the scene.

447
00:43:12,560 --> 00:43:20,420
Okay so we know our Sentinel Logs are stored at /tmp/sentinel.log

448
00:43:20,710 --> 00:43:25,500
And if you hit enter,  you can see the Logs.Okay.

449
00:43:25,500 --> 00:43:27,270
Now I'm going to open a new instance

450
00:43:33,150 --> 00:43:33,520
okay.

451
00:43:33,560 --> 00:43:39,090
So basically this is again the Masters,

452
00:43:39,130 --> 00:43:47,830
Master node and I had just opened a new session.  So you can verify the same using Host name -i

453
00:43:48,050 --> 00:43:59,380
And this is the IP address of the master node.  So here we are going to shut down the services of a Master

454
00:43:59,380 --> 00:44:04,150
Node.  So now there are two ways to shut down Master Node. If you want to shut down the services,

455
00:44:04,300 --> 00:44:11,590
Redis services gracefully. You can use Redis-cli and you can provide the name which is

456
00:44:11,580 --> 00:44:18,740
10.128.0.2 and provide the Port number, which is 6 3 7 9.

457
00:44:18,740 --> 00:44:22,850
And here you can write the command which is called Shut Down.

458
00:44:23,190 --> 00:44:32,190
Okay so it is going to shut down the Master Node.  However since this is not a you know,  we want to simulate

459
00:44:32,880 --> 00:44:39,450
a Production scenario and typically in a Production scenario service will, service may go down abruptly,

460
00:44:39,480 --> 00:44:42,000
when the server goes down.

461
00:44:42,000 --> 00:44:47,370
So we can just use ps-ef  command to kill the Redis service

462
00:44:52,010 --> 00:45:01,850
So here we can see that this server is running on Port 6 3 7 9 and this is a process ID.  So I will

463
00:45:01,850 --> 00:45:06,910
use kill command.  kill -9 and the process ID.

464
00:45:06,920 --> 00:45:15,820
So this is going to kill  Redis Master Node. So once you do that, within 30 sec, we should be able to see

465
00:45:16,200 --> 00:45:21,940
you know, some changes happening here and Sentinels should be able to detect that Master is down and

466
00:45:21,940 --> 00:45:28,550
it should be able to promote one of the existing Slave Nodes to a Master Node.  So let's see how this

467
00:45:28,550 --> 00:45:28,940
works.

468
00:45:30,410 --> 00:45:31,290
So I'm back here.

469
00:45:31,300 --> 00:45:39,670
Now I'm going to hit enter and if we do ps-ef grep Redis.

470
00:45:39,730 --> 00:45:47,750
We can see we have only Redis Sentinel running but there is no Redis Server running.

471
00:45:48,120 --> 00:45:56,470
So Redis Server is down . Okay let's clear the screen and let's wait for around 20 more seconds.

472
00:45:57,560 --> 00:46:03,650
Because our setting is set to 30 seconds.  So Sentinel is going to take 30 seconds to make sure

473
00:46:03,650 --> 00:46:08,500
that it is down. As we can see now Sentinel is into action.

474
00:46:08,540 --> 00:46:13,040
It has displayed so many logs.

475
00:46:13,050 --> 00:46:17,080
So basically what it is doing here is, if you try to understand the Log.

476
00:46:27,590 --> 00:46:30,720
So yeah, from here actually we can see that it is saying that

477
00:46:34,570 --> 00:46:35,710
+sdown.

478
00:46:35,710 --> 00:46:39,850
So basically what that means is you can see here +sdown.

479
00:46:39,850 --> 00:46:45,670
So basically it has detected that Master is down and it is now trying the failover. You can see the

480
00:46:45,670 --> 00:46:50,740
logs here and then it is trying the action, which is called Vote for Leader.

481
00:46:50,860 --> 00:46:51,120
Okay.

482
00:46:51,130 --> 00:47:00,540
So this is where you know, a minimum of 2 Sentinel nodes has to Vote and Agree and choose a, you know,

483
00:47:00,620 --> 00:47:02,350
Node which can become Master.

484
00:47:02,670 --> 00:47:02,960
Okay.

485
00:47:02,980 --> 00:47:07,030
So here you can see they have said Elected leader master, which is

486
00:47:09,820 --> 00:47:19,220
currently it is pointing to this Master Node and now if you see here, we can see here it has promoted

487
00:47:19,220 --> 00:47:24,040
one of the Slave Node, which is 10.128.0.4  as the Master Node.

488
00:47:44,570 --> 00:47:48,560
and also if you see at the bottom, now you can see,

489
00:47:52,630 --> 00:47:59,210
if you look at here.  You can see that IP address, 10.128.0.5  is still a Slave.

490
00:47:59,530 --> 00:48:07,870
And also  the previous master node which was running on 10.128.0.2  has now turn into a Slave

491
00:48:07,870 --> 00:48:08,110
Node.

492
00:48:10,960 --> 00:48:12,130
OK.

493
00:48:12,360 --> 00:48:20,640
Now we can actually log into Node 4 which is 10.128.0.4,  which has become Master Node.

494
00:48:30,200 --> 00:48:37,130
Okay and let's perform a Set operation to make sure that we are able to write something because Master,

495
00:48:37,460 --> 00:48:41,860
on Master node we should be able to do the write operations.

496
00:48:41,860 --> 00:48:48,330
Okay so I'm going to enter a Product Value or a Product Name in this case.

497
00:48:49,030 --> 00:48:49,290
Okay.

498
00:48:49,300 --> 00:48:56,070
So once I hit enter, you can see it is, if I make it a bit bigger you can see it has replied with.

499
00:48:56,110 --> 00:48:57,200
Okay.

500
00:48:57,370 --> 00:49:00,580
Which means it is now accepting our write request.

501
00:49:02,610 --> 00:49:11,010
So I will exit from here and what we will do is, let's start Redis Server again and see what happens

502
00:49:11,010 --> 00:49:12,560
when Redis Server is started or

503
00:49:12,570 --> 00:49:14,550
What is the action  which Sentinel is going to take.

504
00:49:18,340 --> 00:49:23,140
Right now if you see there is still a Line which is saying +sdown.  So +sdown means is, one

505
00:49:23,140 --> 00:49:28,910
of the Slave is down and this is the IP address of the Slave, which is down. Okay.

506
00:49:28,950 --> 00:49:36,250
So it should be changing to -s down.  Once we bring up the server again okay.

507
00:49:36,280 --> 00:49:42,720
So once we bring up the previous Master up again. It is not going to be promoted to Master.

508
00:49:42,810 --> 00:49:44,370
You know it is still going to be a Slave.

509
00:49:46,140 --> 00:49:54,570
So this will continue to work as a slave as long as you know, none of the node goes down.  So this

510
00:49:54,570 --> 00:50:01,570
node which is running on, 10.128.0.4  will continue to work as a Master.

511
00:50:01,680 --> 00:50:06,850
Okay so let's start Redisdb on

512
00:50:06,860 --> 00:50:07,750
Master node again.

513
00:50:07,760 --> 00:50:08,990
I mean Previous Master Node.

514
00:50:18,450 --> 00:50:24,980
Okay hit enter and now you can see, as soon as we hit enter, services  started here.

515
00:50:24,990 --> 00:50:32,010
There is a new entry came which is saying -sdown Slave. So means now it has detected that Slave

516
00:50:32,010 --> 00:50:33,220
node is up again.

517
00:50:33,300 --> 00:50:33,500
Okay.

518
00:50:33,510 --> 00:50:41,270
This is the same Slave Node which was previously  Master. So this also verifies that our Master or our

519
00:50:41,270 --> 00:50:46,880
Cluster is working fine, because Master Slaves are able to connect to each other,  able to reply to each

520
00:50:46,880 --> 00:50:47,140
other.

521
00:50:50,010 --> 00:50:58,470
Let's also see the value you know, which we have inserted in, by connecting to new master node is replicated

522
00:50:58,500 --> 00:51:02,160
now to this Slave Node, which  was down and now it has come up.

523
00:51:02,280 --> 00:51:02,570
Okay.

524
00:51:02,580 --> 00:51:03,280
So let's see

525
00:51:08,810 --> 00:51:09,330
one second.

526
00:51:09,330 --> 00:51:11,300
So yeah let me clear the screen first.

527
00:51:14,420 --> 00:51:20,360
So I will use Redis-cli using -h,  we will specify the Host which we want to

528
00:51:20,360 --> 00:51:20,870
connect to.

529
00:51:20,890 --> 00:51:25,220
So we want to connect to 10.128.0.4,  which is the New Master.

530
00:51:26,490 --> 00:51:32,780
Oh I'm sorry, this case we should be connecting to 10.128.0.2, which is the Slave Node which has

531
00:51:32,780 --> 00:51:33,650
just started now.

532
00:51:34,640 --> 00:51:35,120
Okay.

533
00:51:35,180 --> 00:51:44,710
And Port is going to be 6 3 7 9 and if we do Get product.  Now we can see that we have got the product

534
00:51:44,710 --> 00:51:52,930
value. So this node was previously a master node.  It went down, then Sentinel made,  one of the existing

535
00:51:52,930 --> 00:51:57,880
Slave Node, a master node which is 10.128.0.4

536
00:51:58,030 --> 00:52:04,660
And then we brought this node back again and this node is now going to continue to act as Slave Node.

537
00:52:07,210 --> 00:52:07,460
okay.

538
00:52:07,480 --> 00:52:14,270
So that's all about setting up Cluster in a Production Environment and making your Redis in a,

539
00:52:15,140 --> 00:52:16,960
I mean  running in a High Availability Mode.
