1
00:00:01,880 --> 00:00:02,330
So in this session

2
00:00:02,380 --> 00:00:08,500
we are going to learn about setting up a Master Slave Configuration, which is going

3
00:00:08,500 --> 00:00:15,460
to be a Production like setup and also we will try to simulate a Production Failure.

4
00:00:15,460 --> 00:00:22,090
So we are going to shut down one Master Server and then we will be creating a New Master Server on the

5
00:00:22,090 --> 00:00:26,890
fly and the existing Slave Server, we are going to point to the New Master Server

6
00:00:30,880 --> 00:00:39,400
and in this example I'm going to use three servers. So first server is 10.128.0.4 and

7
00:00:39,400 --> 00:00:46,760
Host name is itpanther02 and Second Server is going to be a Slave Server, which is having IP address

8
00:00:46,760 --> 00:00:52,880
of 10.128.0.5 and

9
00:00:52,910 --> 00:00:56,130
Host name is itpanther03.  Okay.

10
00:00:56,150 --> 00:01:02,420
So we will set up a Master Slave Configuration on these two servers and then we are going to shut down

11
00:01:02,960 --> 00:01:11,610
a Master Server, which is 10.128.0.4 and then we are going to log into a New Server

12
00:01:11,640 --> 00:01:19,740
which is, 10.128.0.6 and there are we are going to set up Redis again. A brand new installation

13
00:01:20,910 --> 00:01:28,110
and then we are going to, you know, move these existing server or point this existing server, Slave Server

14
00:01:28,110 --> 00:01:30,490
to this New Master Server.

15
00:01:30,780 --> 00:01:37,610
And of course we'll be making sure that whatever data which has been written on, you know, previously Master

16
00:01:37,630 --> 00:01:40,740
and Slave, that should be available in the New Master Server.

17
00:01:41,340 --> 00:01:41,610
Okay.

18
00:01:41,610 --> 00:01:48,050
So basically we should be having 0 Data Loss. So let's begin.

19
00:01:54,230 --> 00:01:59,840
So you can verify this is a first server, which is going to be a Master Server. The IP address is

20
00:02:00,050 --> 00:02:01,190
10.128.0.4

21
00:02:04,080 --> 00:02:04,820
Right now,

22
00:02:05,580 --> 00:02:15,630
I am in /home/redisadmin directory and I have downloaded the software which is Redis 5

23
00:02:15,780 --> 00:02:22,030
And also I have extracted this software and now we have a Redis-stable directory.

24
00:02:22,740 --> 00:02:24,810
So let's go into this directory

25
00:02:32,360 --> 00:02:37,230
and let's make changes into Redis.conf,  Configuration File.

26
00:02:44,370 --> 00:02:49,850
So the first thing which we need to do, is change the bind address to the actual IP address, where we

27
00:02:49,860 --> 00:02:54,050
are running this Redis Server.

28
00:02:54,150 --> 00:02:58,410
So it is going to be in this case 10.128.0.4

29
00:03:06,500 --> 00:03:08,670
and if  you want to change the port, you can change it.

30
00:03:08,690 --> 00:03:12,560
In my case,  I'm just going to leave it to default which is 6 3 7 9

31
00:03:17,810 --> 00:03:23,780
and log file I'm going to change it to /tmp/redis.log

32
00:03:24,080 --> 00:03:24,340
OK.

33
00:03:24,350 --> 00:03:30,310
So we want logs to be written to /tmp/redis.log

34
00:03:40,040 --> 00:03:43,700
and also we want RDB back up to be created to

35
00:03:46,350 --> 00:03:51,300
Directory which is called,  /home/redisadmin

36
00:03:54,040 --> 00:03:54,320
OK.

37
00:03:54,330 --> 00:04:01,650
So you see, db file name is set up to dump.rdb  and if you want, you can change this name as well.

38
00:04:02,370 --> 00:04:08,850
So in this example I'm not going to change it. I'm going to leave it as it is  and directory is going to

39
00:04:08,850 --> 00:04:10,650
be /home/redisadmin

40
00:04:14,040 --> 00:04:22,830
So the RDB back up will be creating into this directory. So that's all required on the Master Configuration.

41
00:04:22,850 --> 00:04:24,440
Now I'm going to save and exit

42
00:04:31,290 --> 00:04:31,720
okay.

43
00:04:31,750 --> 00:04:34,810
Now let's log into SlaveS erver.

44
00:04:39,310 --> 00:04:45,700
So either you can open a new session, new and log In there or otherwise you can just use ssh to log

45
00:04:45,700 --> 00:04:53,510
into any other sever and in my case I have set up  Passwordless authentication .

46
00:04:53,850 --> 00:04:59,820
So basically I'll set up a ssh key authentication.  So I don't need to provide password.

47
00:05:00,020 --> 00:05:00,350
OK.

48
00:05:00,360 --> 00:05:08,090
In your case if you are getting some error related to authentication,  just make sure you have setup ssh

49
00:05:08,100 --> 00:05:15,940
authentication or otherwise you can open a New Session and there you can provide the IP details of

50
00:05:15,940 --> 00:05:25,580
Slave Server.  So I'm going to now log into  itpanther03, which is having IP address of

51
00:05:25,590 --> 00:05:26,760
10.128.0.5

52
00:05:30,130 --> 00:05:35,510
Okay now we can verify the IP address by using Host name space -i

53
00:05:35,510 --> 00:05:40,280
Command and you can see the IP address is 10.128.0.5

54
00:05:41,360 --> 00:05:44,970
And currently we are in to /home/redisadmin directory

55
00:05:45,020 --> 00:05:53,630
And if I do ls-lrt,  you can see currently we do not have Redis software available here.

56
00:05:55,780 --> 00:06:01,420
So what I will do is since I already have the Software on itpanther02 server. So I'm going

57
00:06:01,420 --> 00:06:02,790
to copy from there.

58
00:06:03,710 --> 00:06:09,460
So I'll exit from here and we are back to itpanther02 server.

59
00:06:09,480 --> 00:06:10,870
So here we have the software.

60
00:06:10,870 --> 00:06:16,290
So I will use scp  command to copy the software to the Remote Server.

61
00:06:19,350 --> 00:06:24,900
So command to do that is scp  -r  Redis-stable.

62
00:06:24,900 --> 00:06:29,440
I want to copy this Complete Directory and sub- directories.

63
00:06:29,700 --> 00:06:32,780
And now we need to provide the Remote Server where you want to copy this.

64
00:06:32,780 --> 00:06:35,880
So it is going to be itpanther03

65
00:06:36,060 --> 00:06:39,340
So I'm providing the Host name but you can do the same with IP name as well.

66
00:06:40,740 --> 00:06:43,130
And we want to copy to the Home Directory.

67
00:06:43,230 --> 00:06:51,000
So the way to do that is, you need to provide : after Host name and then you use ~ character

68
00:06:51,660 --> 00:06:59,780
and then /. Hit enter. and Software copy is in progress.

69
00:07:03,170 --> 00:07:03,470
okay.

70
00:07:03,480 --> 00:07:10,620
Let me clear the screen and let me go to itpanther03 server.

71
00:07:10,690 --> 00:07:14,730
We verify Host name  -i

72
00:07:15,340 --> 00:07:16,400
We verify the IP.

73
00:07:16,400 --> 00:07:24,370
Now we can do ls-lrt. We can see Redis-stable is already  moved here.

74
00:07:28,180 --> 00:07:33,040
Now I'm going to make the configuration changes here. Okay.

75
00:07:33,220 --> 00:07:37,840
So by default whatever configuration which we had done their on Master,  has come here because we just

76
00:07:37,840 --> 00:07:42,890
copy pasted the software on this machine.

77
00:07:43,110 --> 00:07:48,150
However in this case we need to make sure we change the bind address because this is a different server.

78
00:07:48,180 --> 00:07:55,990
So we need to provide the IP address of this server, which is in this case going to be

79
00:07:56,010 --> 00:07:57,360
10.128.0.5

80
00:08:02,570 --> 00:08:07,140
and I want all the logs to be going to /tmp/redis.log

81
00:08:07,140 --> 00:08:10,470
So this is already good. I do not want to make any changes here.

82
00:08:13,670 --> 00:08:25,070
And now next thing which we need to change here is related to you know,  the RDB backup.

83
00:08:25,070 --> 00:08:31,250
So I think this is also OK in this case. So we will just leave it to the same directory because I had

84
00:08:31,250 --> 00:08:35,100
the same directory standard followed on all the servers.

85
00:08:35,880 --> 00:08:36,240
OK.

86
00:08:36,260 --> 00:08:37,890
So I'm just going to leave it as it is.

87
00:08:37,910 --> 00:08:47,570
And now we need to set up Replica. So on Master Server we have not made any changes to this line or

88
00:08:47,570 --> 00:08:50,150
this directive. Here we need to make changes.

89
00:08:50,240 --> 00:08:57,860
So uncomment the line and after Replica of,  you need to provide the IP address of the Master Server

90
00:08:57,920 --> 00:09:03,910
which is in this case going to be 10.128.0.4

91
00:09:04,630 --> 00:09:05,030
Okay.

92
00:09:05,030 --> 00:09:09,010
And Master Port, as we know we haven't made any changes  in the port.

93
00:09:09,020 --> 00:09:14,810
So by default it is going to be running on Port 6 3 7 9

94
00:09:17,740 --> 00:09:18,390
So that's.

95
00:09:18,430 --> 00:09:26,470
Now we can save and exit  and now we have software installed on, I mean the configuration is done on both the

96
00:09:26,470 --> 00:09:28,780
server, which is Master Server and the Slave Server.

97
00:09:28,780 --> 00:09:30,080
So now we can go ahead and

98
00:09:33,580 --> 00:09:34,600
start these Servers.

99
00:09:34,600 --> 00:09:34,800
Okay.

100
00:09:34,810 --> 00:09:38,460
So  let me start Master first.

101
00:09:38,740 --> 00:09:42,370
So I will go back to

102
00:09:45,700 --> 00:09:47,740
you know,  Master Server.

103
00:09:47,740 --> 00:09:49,690
We will verify the IP address.

104
00:09:49,960 --> 00:10:02,970
So this is the IP address of Master Server.

105
00:10:03,740 --> 00:10:06,480
So I will go to Redis -stable directory.

106
00:10:06,710 --> 00:10:10,430
And here we need to go inside src directory

107
00:10:20,250 --> 00:10:20,550
okay.

108
00:10:20,560 --> 00:10:23,090
Here you see we have Redis -server utility.

109
00:10:23,090 --> 00:10:25,680
So this is what we need to start.

110
00:10:25,930 --> 00:10:27,380
Let me clear the screen first.

111
00:10:27,400 --> 00:10:36,140
So we are into this directory and now I'm doing /./Redis- Server

112
00:10:37,100 --> 00:10:42,660
And when we are starting Redis,  we also need to provide the full path of the configuration file.

113
00:10:42,740 --> 00:10:43,990
Redis.conf file.

114
00:10:45,320 --> 00:10:57,220
So I know that is located at /home/redisadmin/redis-stable/redis.conf

115
00:10:59,340 --> 00:11:02,520
And also I want to start this as a background process.

116
00:11:02,520 --> 00:11:09,990
So in the end, I'm giving & symbol. So that's it. If we hit enter, now Masters should start

117
00:11:11,700 --> 00:11:15,090
and also we can verify by checking the logs.

118
00:11:15,090 --> 00:11:21,930
So as we remember in the Configuration, we have given the,  that logs should be saved  to

119
00:11:23,850 --> 00:11:24,750
/tmp/redis.log

120
00:11:25,020 --> 00:11:26,190
So let's check the logs.

121
00:11:31,410 --> 00:11:31,810
Okay.

122
00:11:31,830 --> 00:11:36,660
So we see Redis is started. It is  saying Ready to accept connections. So everything looks okay here.

123
00:11:40,230 --> 00:11:41,580
So now I'm going to

124
00:11:44,200 --> 00:11:48,340
move to Slave Server which, is 10.128.0.5

125
00:11:55,980 --> 00:11:56,680
okay.

126
00:11:56,710 --> 00:11:59,530
And you can verify the IP address.

127
00:11:59,530 --> 00:12:01,000
So this is the correct IP address.

128
00:12:01,000 --> 00:12:04,990
Now let's go to Redis table.

129
00:12:04,990 --> 00:12:06,580
Go to cd src

130
00:12:10,860 --> 00:12:19,780
and here we can do Redis-server and also provide the full path of the wherever your configuration

131
00:12:19,780 --> 00:12:20,620
file is.

132
00:12:20,620 --> 00:12:24,010
So in this case it is at

133
00:12:27,330 --> 00:12:31,130
/home/redisadmin/redis-stable/redis.conf

134
00:12:32,880 --> 00:12:34,670
And also I'm going to use &

135
00:12:43,000 --> 00:12:49,930
and let's see the log by going to /tmp/redis.log

136
00:12:49,950 --> 00:12:55,520
So now on the Slave Server,  when we went to redis.log, you can see that it is saying that Master

137
00:12:55,530 --> 00:12:57,960
Replica Sync is successful.

138
00:12:57,960 --> 00:13:04,500
So basically when we started Slave Server it was knowing that it is a Slave Server and it has to

139
00:13:04,500 --> 00:13:05,880
connect to a Master Server.

140
00:13:06,420 --> 00:13:14,330
So it tried connecting connecting to the Master Server and the connection was successful.

141
00:13:14,370 --> 00:13:15,600
So now we will use

142
00:13:18,470 --> 00:13:21,600
redis-cli utility to connect to Master Node.

143
00:13:28,870 --> 00:13:34,900
So just remember using redis-cli,  you can connect to any number of servers.  You just need

144
00:13:34,900 --> 00:13:40,930
to provide the correct IP address to which you want to connect to.

145
00:13:40,930 --> 00:13:45,790
So I do not, if I want to connect to  Master Server.  I do not need to go to the Master Server.

146
00:13:47,470 --> 00:13:48,190
Okay.

147
00:13:48,250 --> 00:13:52,330
I can just stay on this server which is itpanther03,  which is a Slave Server and

148
00:13:52,330 --> 00:13:55,890
I still can connect to any server.

149
00:13:55,900 --> 00:14:04,430
So I will do redis-cli then space -h

150
00:14:04,430 --> 00:14:11,270
Here you need to provide the  Host name.  Either Host name or IP address.  So let's provide IP address in this

151
00:14:11,270 --> 00:14:21,890
case and also if you are running Redis on non default port, which is the port

152
00:14:21,910 --> 00:14:29,020
Other than 6 3 7 9 then also you can provide that port by using -p and whatever the port

153
00:14:29,080 --> 00:14:30,940
you are running Redis on.

154
00:14:30,940 --> 00:14:37,240
So if you are running on a default port which is  6 3 7 9,  then you do not need to provide the Port but

155
00:14:37,240 --> 00:14:41,520
if you still want to be explicit, then you still can provide the port.

156
00:14:42,360 --> 00:14:43,000
OK.

157
00:14:43,150 --> 00:14:49,290
So it is going to work the same way regardless of whether I use -P or not.

158
00:14:49,520 --> 00:14:58,330
I mean whatever, whether I use this port part or not but let's say in case I had changed the port

159
00:14:58,330 --> 00:15:05,440
from 6 3 7 9 to some other port and then I tried to connect to this node without providing the port

160
00:15:05,440 --> 00:15:11,830
information,  then it will try to connect to 6 3 7 9 port and it will eventually say, that it is not able

161
00:15:11,830 --> 00:15:18,380
to connect.  So in those cases you need to provide the port number.

162
00:15:18,380 --> 00:15:23,140
All right so let's connect. Hit enter and we should be able to connect to the Master Node.

163
00:15:23,900 --> 00:15:31,230
Okay so we see we are able to connect to Master Node and let's do dbsize. So dbsize tells us what is

164
00:15:31,230 --> 00:15:38,280
the total number of keys,  which are available right now in Redis. So since it is a Brand New Fresh

165
00:15:38,370 --> 00:15:42,250
Installation, we do not have any data stored.

166
00:15:42,290 --> 00:15:45,060
Okay we can verify the same with keys *.

167
00:15:45,090 --> 00:15:47,500
So we do not have anything or any keys stored.

168
00:15:48,530 --> 00:15:58,650
I will  store a key, I will  store a list rather with Color and let's name it, let's  provide some of the values.

169
00:16:09,240 --> 00:16:10,500
Hit enter.

170
00:16:10,620 --> 00:16:19,770
So now we have 6 values stored in a key which is called Color and if you want to see all the items which

171
00:16:19,770 --> 00:16:27,180
is inside the Color Key. So we can use L range and the key name which is Color and Starting index which

172
00:16:27,180 --> 00:16:35,870
is going to be 0 and then Ending index.  Since I want to print everything I need to use -1.  so

173
00:16:35,870 --> 00:16:40,280
-1 means is basically print everything in this case.

174
00:16:40,430 --> 00:16:46,440
Okay so if we hit enter,  we can see we have all the information.

175
00:16:46,520 --> 00:16:55,730
Now I'm going to exit by using Quit and then now I'm going to connect to Slave Node.

176
00:16:55,880 --> 00:17:03,700
Okay so we need to change the IP address. Slave Node IP address is 10.128.0.5.  I have change the IP address.

177
00:17:03,770 --> 00:17:05,090
Hit enter.

178
00:17:05,090 --> 00:17:10,850
Now you are connected to the Slave Node. So whatever you have written there on the Master Node, you should

179
00:17:10,850 --> 00:17:14,680
be able to get the same data here on the Slave Node.

180
00:17:15,080 --> 00:17:23,730
So I will do L range and provided the key name and the starting and end range.

181
00:17:23,900 --> 00:17:24,280
Okay.

182
00:17:24,740 --> 00:17:30,120
So once I do, I can see that I have got the same information on the Slave Node also.

183
00:17:30,320 --> 00:17:36,800
Now to verify that it is really a Slave Node and it is not allowing any you know, right connection you

184
00:17:36,800 --> 00:17:40,730
can try to give a or

185
00:17:47,040 --> 00:17:48,580
try issuing an

186
00:18:14,940 --> 00:18:22,170
Now to make sure this is a really a Slave Node, we can actually issue a  Set command. It should give

187
00:18:22,170 --> 00:18:30,550
us an error saying that,  It is a Read Only Replica.  So let's do  a Set command and try to update a key

188
00:18:30,580 --> 00:18:31,740
which is called Product.

189
00:18:32,040 --> 00:18:39,400
And let's try to give a Value Name which is Chair.  Hit enter and you see we are getting the error that this

190
00:18:39,400 --> 00:18:40,600
is a Read Only Replica.

191
00:18:40,990 --> 00:18:41,220
Okay.

192
00:18:41,230 --> 00:18:50,450
So this confirms that this Server or this Node, which we are connected to right now is actually a Slave Node.

193
00:18:50,980 --> 00:18:52,890
Okay so I will quit again from here

194
00:18:55,780 --> 00:19:01,180
and let me clear the screen. Let's do Host name -i

195
00:19:01,800 --> 00:19:08,850
So you see we are actually on Slave Node Server and also now let's see the you know,

196
00:19:12,400 --> 00:19:16,110
existence of Slash.

197
00:19:16,260 --> 00:19:20,700
Basically we want to see whether the dump.rdb file   is created or not. So if you remember

198
00:19:20,700 --> 00:19:25,360
we have given path  of /home/redisadmin

199
00:19:25,560 --> 00:19:27,380
So here we should be able to see

200
00:19:27,410 --> 00:19:28,410
dump.rdb file

201
00:19:28,590 --> 00:19:31,890
Yes we see the file is already available here.

202
00:19:33,130 --> 00:19:33,390
OK

203
00:19:37,080 --> 00:19:43,350
now we are good to mimic you know, Master fail scenario. So we will log into

204
00:19:46,650 --> 00:19:48,760
itpanther02  server.

205
00:19:51,670 --> 00:19:53,830
so now let's verify that we are on

206
00:19:56,810 --> 00:19:58,650
yeah, we are on the Master node.

207
00:19:58,850 --> 00:19:59,200
Okay.

208
00:19:59,200 --> 00:20:01,130
And now I'm going to shut down this server.

209
00:20:10,150 --> 00:20:18,160
So once we do that, we no longer will be able to, basically connect to this session. So I'm going to open

210
00:20:18,160 --> 00:20:19,110
a new session.

211
00:20:21,010 --> 00:20:23,050
Or let me open a Duplicate Session

212
00:20:30,240 --> 00:20:30,540
okay.

213
00:20:30,540 --> 00:20:36,560
So on this session I'm going to switch to Slave

214
00:20:36,590 --> 00:20:36,880
Node.

215
00:20:38,790 --> 00:20:39,360
Okay.

216
00:20:39,360 --> 00:20:45,930
So here if you verify this is a Slave Node and here you can verify this a Master Node.

217
00:20:45,930 --> 00:20:55,240
Now I'm going to do sudo space shutdown and before that let's also do  tail -F on Slave Node. So

218
00:20:55,240 --> 00:20:57,150
we can actually see the error.

219
00:20:57,250 --> 00:21:00,280
Okay when we are shutting down the Master Server.

220
00:21:00,490 --> 00:21:03,030
Okay so let me shut it down.

221
00:21:05,550 --> 00:21:09,900
Okay so shut down command has issued and now this server is going to get shut down.

222
00:21:09,930 --> 00:21:11,780
Now let's see the logs here.

223
00:21:27,630 --> 00:21:29,330
So whatever message you saw here.

224
00:21:29,350 --> 00:21:32,550
Actually this is not related to Redis log.

225
00:21:32,550 --> 00:21:36,450
This is basically because we open the session as a duplicate session.

226
00:21:36,450 --> 00:21:40,440
So this is the message from itpanther02  server.

227
00:21:40,770 --> 00:21:43,050
Anyhow we can run this command again.

228
00:21:43,050 --> 00:21:45,330
So we are able to see the latest logs

229
00:21:50,620 --> 00:21:56,430
Okay so as of now Master server, still is in the process of shutting down.

230
00:21:57,270 --> 00:21:59,640
So we do not see any error here as of now.

231
00:22:05,390 --> 00:22:05,680
Okay.

232
00:22:05,730 --> 00:22:09,280
So now we see that we get the error, which means

233
00:22:14,020 --> 00:22:15,980
that server has been disconnected.

234
00:22:24,760 --> 00:22:31,570
So since we opened it as a Duplicate session or somehow this session is not allowing us to see anything

235
00:22:31,570 --> 00:22:32,390
and this session

236
00:22:32,410 --> 00:22:40,840
Also has went to a  inactive state.  So rather  I will open a new session and then we log into the Slave

237
00:22:40,840 --> 00:22:41,060
Node.

238
00:22:46,050 --> 00:22:51,900
So this is a new session which I have opened and this is a Slave Node.  You can verify the IP address.

239
00:22:52,320 --> 00:22:55,640
Let me close all the previous sessions.

240
00:22:56,480 --> 00:22:58,330
Okay so this is what we have right now.

241
00:23:01,890 --> 00:23:04,940
And just remember that we have shut down the Master server.

242
00:23:04,970 --> 00:23:09,580
So let's verify the logs on Slave server.

243
00:23:15,130 --> 00:23:22,560
Now you see that Slave is getting some time out errors that it is basically not able to connect to Master

244
00:23:22,700 --> 00:23:22,980
node

245
00:23:33,120 --> 00:23:33,420
okay.

246
00:23:33,430 --> 00:23:36,580
So this is an indication that Master is not available.

247
00:23:36,580 --> 00:23:43,120
And also you can use various Redis-cli and use -h and try connecting to the Master Node

248
00:23:51,340 --> 00:23:51,820
you notice

249
00:23:51,820 --> 00:23:56,320
when I hit enter,  I don't see anything or any message.

250
00:23:56,330 --> 00:24:03,870
So basically it has just,  we are not able to connect to this Redis Client,  which is Master Node.

251
00:24:06,640 --> 00:24:08,880
So i press control c to exit

252
00:24:13,360 --> 00:24:17,340
and if we  verify by connecting to Slave Node.

253
00:24:17,450 --> 00:24:23,420
We still can connect to Slave Node and we can see the keys stored here.

254
00:24:28,390 --> 00:24:33,280
And we also can see everything, which is stored here. It is still a Slave Node,  because if you try to update

255
00:24:33,280 --> 00:24:36,750
any value,  you won't be able to do it.

256
00:24:37,070 --> 00:24:46,430
Okay so now let's connect to a New Server which in this case is going to be,  bind address

257
00:24:46,520 --> 00:24:47,870
And here we will do the setup.

258
00:24:54,290 --> 00:24:58,150
Okay so right now we are on Slave Node.

259
00:24:58,250 --> 00:25:05,370
I'm going to do ssh itpanther04 and now if we do Host name -i ,  you can see will log

260
00:25:05,480 --> 00:25:05,780
to

261
00:25:10,090 --> 00:25:12,470
10.128.0.6

262
00:25:12,490 --> 00:25:15,760
Now here right now,  I do not see any Redis  software.

263
00:25:15,760 --> 00:25:22,200
So this is you can assume, it is a fresh server, where we do not have Redis  software also available.

264
00:25:22,200 --> 00:25:24,990
So I'm going to go back to Slave Node.

265
00:25:25,000 --> 00:25:26,710
From there I will copy the software.

266
00:25:27,190 --> 00:25:29,440
And also I will copy dump.rdb

267
00:25:41,270 --> 00:25:41,780
okay.

268
00:25:41,790 --> 00:25:45,560
So here we will do scp -r, let's copy this software

269
00:26:01,660 --> 00:26:04,720
and now we will copy dump.rdb as well.

270
00:26:05,030 --> 00:26:05,350
Okay.

271
00:26:10,990 --> 00:26:19,090
Because if you remember dump.rdb is having the or this  is the basically a snapshot.

272
00:26:19,150 --> 00:26:19,540
Okay.

273
00:26:19,540 --> 00:26:28,230
And before we actually copy this dump.rdb,  we should actually make sure that this is the latest

274
00:26:28,860 --> 00:26:29,580
dump file.

275
00:26:29,790 --> 00:26:32,120
Okay so this is the latest RDB file.

276
00:26:32,370 --> 00:26:38,670
Now  the way to ensure that is, actually you can use a safe command again.

277
00:26:38,730 --> 00:26:46,340
That will make sure that it creates a latest dump.rdb file.  So for that I will connect to

278
00:26:46,340 --> 00:26:53,400
Redis-cli like and provide the Slave IP address.

279
00:27:03,070 --> 00:27:04,230
Syntax was incorrect.

280
00:27:04,240 --> 00:27:07,500
So that's why we couldn't connect okay.

281
00:27:07,510 --> 00:27:12,390
So here I will write or I will hit save command.  Type save.

282
00:27:12,400 --> 00:27:18,820
Hit Enter. Now it replies Okay.  So now it has created the latest dump.rdb file.  So we can quit

283
00:27:18,820 --> 00:27:24,010
from here.  So you can use either Quit command or exit command. Both works the same way.

284
00:27:26,260 --> 00:27:29,910
OK.

285
00:27:30,120 --> 00:27:36,150
Now you see dump.rdb size previously and now there is a difference.  So basically this was, this might

286
00:27:36,150 --> 00:27:38,670
be a little  not up to date.

287
00:27:38,670 --> 00:27:40,500
This is the up to date, most up to date.

288
00:27:40,890 --> 00:27:51,980
So now we are good to copy this software.  So we will copy this dump.rdb to Remote Server

289
00:27:52,070 --> 00:28:00,630
which is itpanther04 and also we'll copy it to the home directory.  Okay.

290
00:28:00,660 --> 00:28:10,350
So this is copied and now we will connect to new server which is itpanther04

291
00:28:10,600 --> 00:28:12,070
You can verify the IP address.

292
00:28:12,070 --> 00:28:14,860
So now we are connected to this New Server.

293
00:28:17,590 --> 00:28:17,930
okay.

294
00:28:17,960 --> 00:28:26,450
So here again go inside where Redis-stable and make sure the configuration is as per the New

295
00:28:26,450 --> 00:28:26,810
Node.

296
00:28:26,960 --> 00:28:27,300
Okay.

297
00:28:27,320 --> 00:28:31,190
So i am opening Redis.conf file and here

298
00:28:31,190 --> 00:28:34,760
make sure whatever the  bind address,

299
00:28:38,690 --> 00:28:44,460
yeah whatever the bind address, IP addresses is. This  should be the new server's IP address.

300
00:28:44,450 --> 00:28:46,880
So here I have changed it from five to six.

301
00:28:47,860 --> 00:28:51,250
Okay because IP address of this server is 6

302
00:28:51,470 --> 00:28:54,640
And if you want to make any changes here in the log file you can make.

303
00:28:54,660 --> 00:28:59,180
But I just follow the standard.  So I'm keeping you in  /tmp/redis.log

304
00:29:02,040 --> 00:29:08,340
and the most important step is, this directory should be pointing to the directory where you have the

305
00:29:08,340 --> 00:29:10,330
latest dump.rdb file.

306
00:29:10,860 --> 00:29:17,430
Because when you start this server it is going to pick that latest dump.rdb to copy everything

307
00:29:17,970 --> 00:29:18,690
and restore.

308
00:29:18,900 --> 00:29:26,010
OK so if it is not able to  find dump.rdb,  it is going to assume that there is no data and it

309
00:29:26,010 --> 00:29:34,830
is just going to start blank server,  basically which will not have any data and after that make sure in the

310
00:29:34,830 --> 00:29:35,610
replica of

311
00:29:35,820 --> 00:29:43,500
Since we copied this software from Slave Node.  So we  have replica of enabled.  We need to disable it, because

312
00:29:43,500 --> 00:29:47,580
we don't want this Sever to become a Slave Node. This ever is going to be a Master Node.

313
00:29:47,620 --> 00:29:47,900
OK.

314
00:29:47,910 --> 00:29:59,520
So I have commented the replica of  line. Ok you can verify that here, in this line. So I will save and exit

315
00:30:06,260 --> 00:30:09,390
and now we can go to src directory and we are good  to

316
00:30:12,490 --> 00:30:13,290
start Redis.

317
00:30:13,390 --> 00:30:13,850
OK.

318
00:30:14,500 --> 00:30:18,940
So again to start Redis, you do ./Redis- server

319
00:30:18,940 --> 00:30:23,010
after going inside src directory.  Let me clear the screen.

320
00:30:24,520 --> 00:30:26,590
And this is the current directory, which we are now

321
00:30:30,820 --> 00:30:36,300
and also provide the full path  of the Redis.conf file.

322
00:30:47,840 --> 00:30:48,180
okay.

323
00:30:48,190 --> 00:30:50,920
Now we can check the logs

324
00:30:57,160 --> 00:30:57,490
OK.

325
00:30:57,520 --> 00:31:05,840
So this server has started properly and also now we can connect to this Server and we can verify that we

326
00:31:05,840 --> 00:31:07,490
have the data restored.

327
00:31:22,040 --> 00:31:22,370
Okay.

328
00:31:22,390 --> 00:31:27,130
So we can see whatever dump.rdb  file was there, it  has restored data from there.

329
00:31:33,790 --> 00:31:34,170
OK.

330
00:31:34,190 --> 00:31:37,050
We see all the data which we had put in Color key.

331
00:31:37,070 --> 00:31:44,890
We can see here,  but please remember right now this node is working as a, you know, independent  Master Node and

332
00:31:44,950 --> 00:31:48,460
still the previously Slave node is not pointing to this new Master Node.

333
00:31:49,240 --> 00:31:56,630
So we need to connect to that previous Slave node, by using redis-cli -h  provide the

334
00:31:56,690 --> 00:32:01,150
IP address of previous Slave node, which is 10.128.0.5

335
00:32:04,120 --> 00:32:13,180
Hit enter and here you need to change this and point it  to the New Node.  So the way to do that is you

336
00:32:13,180 --> 00:32:22,030
Slave of command,  which is slaveof and then you provide the New Master's IP address, which is going to

337
00:32:22,030 --> 00:32:25,690
be 10.128.0.6

338
00:32:26,080 --> 00:32:33,820
And also you provide the Port Name.  So once you hit enter, it says Okay.  Now you can quit from here.

339
00:32:38,080 --> 00:32:46,440
Okay, so now let's log into the New Master, which is on IP 10.128.0.6

340
00:32:49,930 --> 00:32:57,450
and now let's see the value again, which we had previously in the Color Key and now to verify that we are

341
00:32:57,450 --> 00:33:05,630
able to write or perform write operations on the Master Node.  I am going to add some for some more values

342
00:33:05,690 --> 00:33:06,800
into this Color Key.

343
00:33:14,230 --> 00:33:19,000
You see we are successfully able to write more values to this key.

344
00:33:19,080 --> 00:33:25,200
Now I'm going to quit from here and we will go back to the Slave Node and we will see that new data

345
00:33:25,200 --> 00:33:27,210
has been replicated there or  not.

346
00:33:31,560 --> 00:33:35,800
Okay so Slave Node is running at 10.128.0.5

347
00:33:36,160 --> 00:33:41,890
And if I do L push here.  You can see I'm not able to you know, write data

348
00:33:41,890 --> 00:33:42,400
here because

349
00:33:42,390 --> 00:33:51,550
this is a Slave Node.  However I will do L range now  and see what is the new value of Color Key.

350
00:33:51,560 --> 00:33:58,010
Okay,  so now we see list has been updated and now we are having  couple of more items, which we had added.
