So in this session we are going to learn how to install Redis on a Windows machine.
But before we begin, it is worth mentioning that officially Redis is not supported on a Windows machine.
So when you are in Production, you are always going to use Redis on a Linux system.
Now to download Redis on a Windows,
you need to click on this link and then you will be taken to a GitHub page. So here you see we have MSI
And also we have a zip version. So I'm going to download this zip version. So just click here.
So the downloading will start
and software is pretty small. It is only 5 MB. So it just takes few seconds to download and once
we have the software downloaded, we need to extract it.
So once that is done, you go inside the extracted folder and there you should be able to see redis-server.
So you double click on this to start.
Now you can see Redis Server has started and it is running on default port which is 6 3 7 9.
And the Process ID is 2 2 5 9 7 2.
OK.
So you do not need to close this. Just minimize this.
And then you can launch redis-cli, which is a Command Line Interface and using this
now you can interact with Redis.
So quickly I'm going to write some data to Redis and then we will read it back just to make
sure that Redis has really been installed.
So I'm going to use L push command and I'm going to provide a Key Name, which is called color and I'm going
to give all the Values.
So let's fill all the color names. Hit enter.
Now we'll see
we have written a Key Name which is called Color with 3 Values.
Now if I want to see all the values back I can use L range
Command, with a Key Name Color.
And we need to specify Starting Index and Ending Index.
So I'm going to give 0 to -1
So what this is going to give me is, the complete list or the complete list of Values.
Basically that is stored in the Color.
So if you see, if I hit enter I'm going to get all the Color Values back.
Now that's the way of installing, you know, with the default Port.
Now if you want to run it and we want to change the Port. So let me shut down this instance.
Now you see Redis is stopped and then we need to make changes in redis.windows.conf
So you can edit this file in, in a Notepad or any other Editor
and search with Port.
And here you can find a Directory which is called Port and here you can specify the new Ports. So in this
case I'm going to change it from 6 3 7 9 to 6 3 7 0. Save the file and then you can Exit.
And now if you again Double Click here on Redis-server, it is again going to start with the
default Port which is 6 3 7 9 because by default when Redis is starting, it is not accepting this configuration
file.
So now if you want to start Redis with this Configuration File, you can open a Command Prompt
and now you need to move onto the Directory where your software is. So our software is inside Redis. No inside
Download folder and then inside Redis folder.
And here we have Redis-server.
And here you need to specify the name of the Configuration File, which is redis.windows.conf
in this case.
And once, now I hit enter it should be starting on a Port which is 6 3 7 0. So let's hit enter.
Now you can see it has started on the Port which is 6 3 7 0
So in this session, you have learnt installing Redis on a Windows machine and also you have learnt
how you can change the default Port to any other Port.