Introduction
In this article, we are going to learn how to download and install the Windows flavor of Redis Cache and will learn the process of getting started with Redis Client and Redis Server.
Who this article is for
This article is for .NET developers and beginners who are working with ASP.NET.
What is Redis?
Redis is an open source (BSD licensed), NoSQL, and in-memory datastore which works on a key-value pair.
Note
In-memory means it stores the data inside RAM. If you are thinking it's similar to other NoSQL databases, like MongoDB, CouchDB etc, let me tell you that it is quite different because it stores the data in random access memory which serves the data faster as compared to the other NoSQL technologies.
What does "BSD licensed" mean?
BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the use and distribution of the covered software. This is in contrast to the copyleft licenses which have share-alike requirements.
Referred from - https://en.wikipedia.org/wiki/BSD_licenses
Operating System support
Redis is supported by all common operating systems.
- Linux
- Mac
- Windows (For Windows, the beta version of Redis has been released)
Downloading
The current version of Redis available for download is 3.2.100.
You can download Redis for Windows from
here.
After downloading, let’s install Redis on our Windows machine.
There are 2 ways you can install Redis.
- Redis-x64-3.0.504.msi (Microsoft Installer)
- Redis-x64-3.0.504.zip (zip files)
If you use Microsoft installer (.msi), then Redis will be installed as a service on Windows. On the other hand, if you use the zip file, it will be a standalone application (without being registered as a service).
Installing Redis on Windows Using the MSI file
Execute the downloaded MSI file on your system. The installer window will open. Click Next.
On the next screen, set the Destination Folder for your Redis application. Let's leave it with the default value.
After setting the destination folder, we need to set the port number for Redis to run. By default, it is “6379”. Here also, we are not going to change anything.
Next, set the Max Memory Limit.
The default memory limit is 100 MB. If you want to set more than that, then click on the checkbox and enter your value.
After clicking on the Next button, it will show the "Install" button. Just click on it to install the product.
After successfully installing Redis on Windows, now, let’s see its folder structure.
Running Redis Server
After installing, the Redis application is installed as a service on Windows. The current state of service is running.
Now, we have checked that the server is running, let’s open the folder location where Redis files are stored.
Running Redis Server as Standalone from the zip file
If you have downloaded the zip version of Redis, then you can directly click on “redis-server.exe” to start the Redis Server.
And in the same way, you can run through Windows command prompt by just calling the path where you have stored the Redis files.
Running the Redis command-line interface (CLI)
To use the built-in Redis Client, we are going to open the folder location where we have installed Redis on Windows and from there, open “redis-cli.exe” to run the command line to Redis Server.
If you double-click on “redis-cli.exe”, it will execute the CLI.
In another way, if you want to open “redis-cli.exe” from Windows CMD, enter the location path and then call “redis-cli.exe”.
Now, let us execute the first command to test if we are connected to the Server.
First Command
We enter the first command as ping with the pings server. That Server sends a response as “PONG”.
Conclusion
In this part of the article, we have learned how to set up Redis on Windows, how to start the Server, and how to execute commands using Redis CLI.