How to deploy multiple Redis instances on windows

Time:2022-10-14

foreword

Due to its single-threaded feature, Redis only occupies one CPU of the machine and cannot find the advantages of multiple CPUs of the machine. In the process of using, we often deploy multiple Redis on one machine.

When learning Redis replication, clustering and other functions, multiple Redis instances are required to complete it. This requires knowing how to deploy multiple Redis instances on Windows. Let me tell you how to perform related operations. I hope you can make progress with me and improve together!

If you find it useful, please give it a thumbs up and go!

file copy

Everyone finds the installation directory of Redis, which contains these files in the picture.

How to deploy multiple Redis instances on windows

Make a copy of the entire folder and rename the folder. Can take the form of redis-port number. For example, I created two folders of Redis instances, Redis-7000 and Redis-7001.

Among them, Redis-x64-3.2.100 is the folder where I just installed Redis, and it is also the instance I am going to use as the master node of Redis.

How to deploy multiple Redis instances on windows

Modify Redis port

Next, we go to the folder we just copied and find the redis.windows.conf and redis.windows-service.conf in it, both files are edited with an editor. Since the default port of Redis is 6379, we can search and modify the port number of 6379. For example, if we enter the folder of 7000, change the port number to 7000. Enter the 7001 folder and change the port number to 7001

Install and start the Redis service

After the port modification is completed, we enter the folders that enter the two respectively. Enter cmd and hit enter to enter the command bar window. Enter in sequence:

//Install Redis service
redis-server --service-install redis.windows.conf --service-name redis-7001 --loglevel verbose

//Start Redis service
redis-server --service-start --service-name redis-7001

How to deploy multiple Redis instances on windows

Check if it works

Entering the Windows service management window, you can find that three Redis instances are up and running.

How to deploy multiple Redis instances on windows

The client that enters the Redis connection, such as RedisDesktopManager, can connect with the new port number.

How to deploy multiple Redis instances on windows