1. Download
1. Redis official website
Note: The official website does not provide a Windows version, only a Linux version.
2. github download address
Releases · microsoftarchive/redis · GitHub
Optional: Download msi package or zip compressed package
What I chose here is the zip compressed package, which can be operated directly through the cmd command window.
2. Installation steps
1. Unzip the Redis compressed package
Select the compressed package, right-click to select Unzip, and save to the specified path.
Open the decompressed file and you will see the following content
2. Create temporary services
In the decompression path, directly enter cmd and press the Enter key to open it.
input the command:
redis-server.exe redis.windows.conf
Start the temporary redis service and you will see the following content
At this point, you need to reopen a cmd window and start the client to check whether the Redis temporary service starts normally.
3. Start the client
Enter the command: redis-cli, as shown in the figure below. If you can enter it normally, it means that the temporary service starts normally.
Use the set and get commands to store and obtain data from the Redis database, as shown in the figure below
4. Create a permanent service
1. Reopen a cmd command window and enter the command
redis-server.exe --service-install redis.windows.conf --loglevel verbose
Open the task manager, click on Services, you can see the Redis service, the single status is stopped
2. Start the service: enter the command in the cmd window
redis-server --service-start
Check whether the Redis service is started: Task Manager-Service-Redis Service. If you see the status is "Running", it means that the startup command was successfully executed.
Here it is: The installation of the Redis service is complete.
Let's check it again. Open the cmd window, start the client, and perform get and set commands. We can see that the service responds normally.
3. Stop the service: enter the command in the cmd window
redis-server --service-stop
Check whether the Redis service is stopped: Task Manager-Service-Redis Service. If you see the status is "Stopped", it means that the stop command was successfully executed.
4. Uninstall the service: Enter the command in the cmd window
redis-server --service-uninstall
3. Password setting
Looking back at the command when we installed the service, the configuration file of the service is redis.windows.conf
redis-server.exe --service-install redis.windows.conf --loglevel verbose
So we need to open the file redis.windows.conf , search for the keyword requirepass foobared, and enter requirepass leeway123 at the end. Here, remember to restart the Redis service after adding it.
When cmd opens the client, we will be prompted that we do not have permission.
Verify permissions and enter commands
auth leeway123
4. Possible problems encountered
When starting the service, you may encounter service startup failure and the error "Redis service failed to start." is reported. Remember to close the temporary service that was started before and try again.
5. Acknowledgments
Thank you all for your reading and support. I hope this article can help you with the problems you encounter. Attached here is the Redis tutorial website Redis tutorial_redis tutorial . If you are interested, you can continue to study in depth.