How to Install Redis on Windows 10 / 11 (Step by Step Tutorial)

How to Install Redis on Windows 10 / 11 (Step by Step Tutorial). In this post, we introduce Redis, its features, benefits then move on the Redis installation on Windows 10 / 11.

So, let’s start with how to Install Redis on Windows 10 / 11 (Step by Step Tutorial).

What Is Redis?

Redis is an open source, in memory data structure store, database, cache, message broker, and streaming engine. Basically, it provides data structures like strings, lists, hashes, sorted sets and streams. Also, it comprises built in replication, transactions, LRU evictions, Lua Scripting, and different levels of on disks persistency.

In these types, you can run atomic operations, like appending a string, pushing an element to a list, union, and difference, Value incrementation in a hash, or getting the highest ranking members in a sorted set.

Since Redis works with an in memory database, it enables you to achieve top performance. Moreover, based on your use cases, it can persist your data periodically by dumping the dataset to disk or appending each command to a disk based log.

Besides, Redis also supports asynchronous replication with the help of fast, non blocking synchronization and auto reconnection with partial resynchronization on net split.

Features Of Redis

Simply put, Redis provides the following features:

  • Transactions – With the help of Redis transaction, you can execute a group of commands centered around MULTI, EXEC, DISCARD, and WATCH orders in a single step.
  • Pub/SubSubscribe, Unsubscribe, and publish implementation of Publish/ subscription to send their information to the recipient (Subscribed). Instead, when the message shows that channel unintentionally, (if applicable) subscribers, maybe there. Subscribers indicate their interest in one or more channels and receive only the information they have an interest in without knowing the editors (if any). Decommissioning publishers and subscribers allows for greater scalability and dynamic network topology.
  • Lua Scripting – The first argument is the script source code. Scripts are written in Lua and run by the Lua 5.1 compiler with Redis.
  • Key Eviction – When using Redis as a cache, allowing old data to be automatically deleted when new data added is convenient. This behaviour is well known in the developer community, as it is the default behaviour of the popular Memcached system.
  • High Availablity with Redis SentinelRedis Sentinel provides high availability for Redis when they do not use Redis Cluster. Basically, Redis Sentinel also provides other side activities such as monitoring, notifications, and acts as a configuration provider for clients.

Benefits of Redis

The advantages of Redis are as follows:

  • In Redis, you can store keys and value pairs of up to 512 MB. It means it can support 1 GB for a single entry.
  • Redis uses its hashing mechanism known as Redis Hashing. Therefore, you can store data as keys or maps, string fields, and values.
  • With Redis, you tend to achieve data replication, a process of setting up master slave cache nodes.
  • The Redis cache can withstand failures and also provide uninterrupted services.
  • Redis has clients in all formal programming languages.
  • With the help of Redis, you can insert big data into its cache effortlessly using mass insertion.
  • The Redis protocol makes the process of implementing a client straightforwardly. It is known as RESP (Redis Serialization Protocol).
  • Since Redis supports transactions, the commands are executed in a queue rather than one at a time.

Now in this part about how to Install Redis on Windows 10 / 11 (Step by Step Tutorial) is to learn about installation part of Redis.

How to Install Redis on Windows 10 / 11

Certainly, Redis is designed to work with server operating system like, Linux, OS X and BSD and is not compatible with Windows systems. So if you want to install Redis on Windows 10 / 11 then you will need to install Ubuntu operating system on your Windows 10 / 11 system.

As I noted, Windows allows you to easily install Ubuntu operating system from the Microsoft store.

Enable Windows Subsystem for Linux

Before starting, you will need to enable the Windows subsystem for Linux on your Windows 10 / 11. Follow the below steps to enable the Windows Subsystem for Linux:

Step 1 – Open the Windows Control Panel as shown below:

Step 2 – Click on the Programs. You should see the following screen:

Step 3 – Click on the “Turn Windows features on or off”. You should see the following screen:

Step 4 – Locate and enable the “Windows subsystem for Linux” then click on the OK button to install this feature. Once the installation is finished, you should see the following screen:

Step 5 – Click on the Restart now button to restart your Windows system.

Install Ubuntu 20.04 on Windows 10 / 11

Next step, after enabling Window Subsystem Linux, follow the below steps to install Ubuntu 20.04 via Microsoft store:

Step 1 – Search and open the “Microsoft Store”. Once the Store is open, go to the search bar, type “Ubuntu”. You should see different Ubuntu apps in the following screen:

Step 2 – Select the Ubuntu 20.04. You should see the following screen:

Step 3 – Click on the Get button to download the Ubuntu 20.04. Once the Ubuntu 20.04 is downloaded, you should see the following screen:

launch ubuntu 20.04

Step 4 – Click on the Launch button to start and open a new terminal windows and shows that Ubuntu 20.04 is being installed, and we need to hold on for a while.

Step 5 – After completed the installation, you will be asked to set a username and password for Ubuntu as shown below:

Install Redis

At this point, Ubuntu 20.04 is installed on your Windows 10 / 11. Now, run the following command on the terminal to update the Ubuntu system packages:

				
					apt update -y
				
			

Once the system is updated, install the Redis server package using the following command:

				
					apt install redis-server -y
				
			

Once the Redis is installed, start the Redis service and enable it to start at system reboot with the following command:

				
					systemctl start redis-server
systemctl enable redis-server
				
			

You can also check the status of the Redis with the following command:

				
					systemctl status redis-server
				
			

But, if you want to stop the Redis service, run the following command:

				
					systemctl stop redis-server
				
			

At this point, Redis is started and listens on port 6379. You can check the listening port using the following command:

				
					ps -ef | grep redis
				
			

You will get the Redis listening port in the following output:

				
					redis       1123       1  0 13:38 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6379
				
			

How to Connect Redis Server

Together, Redis comes with a redis-cli command-line utility that allows you to connect and manage Redis instance via command line. Run the following command to connect to the Redis server instance:

				
					redis-cli
				
			

Once you are connected, you will get the following shell:

				
					127.0.0.1:6379>
				
			

Now, ping the Redis service using the following command:

				
					127.0.0.1:6379> ping
				
			

If everything is fine, you will get the following output:

				
					PONG
				
			

After that, please run the following command to exit from the Redis instance:

				
					127.0.0.1:6379> exit
				
			

Configure Redis for Remote Connection

By default, Redis can be connected only from the local system. So if you want to connect the Redis server from remote machine then you will need to allow the remote connection via Redis configuration file.

Edit the Redis main configuration file using the following command:

				
					nano /etc/redis/redis.conf
				
			

Find the following line:

				
					#bind 127.0.0.1 ::1
				
			

And, replaced it with the following line:

				
					bind your-server-ip
				
			

Save and close the file then reload the Redis service to apply the changes:

				
					systemctl restart redis-server
				
			

You can now connect to the Redis instance from the remote machine by running the following command:

				
					redis-cli -h redis-server-ip ping
				
			

If everything is fine, you will get the following output:

				
					PONG
				
			

Thank you for reading How to Install Redis on Windows 10 / 11 (Step by Step Tutorial). We shall conclude.

How to Install Redis on Windows 10 / 11 (Step by Step Tutorial) Conclusion

In this post, we explained how to install Redis on Windows 10 / 11. We also explained how to enable Windows subsystem for Linux and run Redis on Ubuntu instance. Redis is very popular, fast, flexible in memory database with lots of great data structures. Thanks to those features you have one of the most versatile NoSQL databases.

Take a look at more Redis content in our blog here

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x