Install Redis under windows and deploy it as a service
Redis is an open source (BSD licensed), in-memory data structure storage system that can be used as database, cache, and messaging middleware.
One: download
download link:
windows版本:
https://github.com/MSOpenTech/redis/releases
Linux版本:
官网下载:
http://www.redis.cn/
git下载
https://github.com/antirez/redis/releases
What we are discussing now is the installation and deployment under windows, the latest version under windows is: 3.2.100.
The download address provides a variety of download contents.
Redis-x64-3.2.100.msi is the simplest installation file under windows, and it is convenient to directly write Redis to the windows service.
Redis-x64-3.2.100.zip needs to be decompressed and installed, which is discussed next.
Source code (zip) The zip compressed version of the
source code Source code (tar.gz) The tar.gz compressed version of the source code
Two: installation
Unzip the installation
Unzip the downloaded Redis-x64-3.2.100.zip to a certain address.
start command
Specify to the redis directory through cmd.
Use the command: redis-server.exe to start the service
to have this effect, indicating that the service is started successfully.
Start another cmd, in the redis directory, use the command: redis-cli.exe to start the client,
this effect appears when connecting to the server, indicating that the client is successfully started.
Three: Deployment
Since the redis service is started above, as soon as the cmd window is closed, the redis service is closed. So, set up redis as a windows service.
Before installation, windows service does not include redis service
Install as a windows service
Installation command: redis-server.exe --service-install redis.windows.conf Use the command, the installation is successful, as shown in the figure: the last parameter --loglevel verbose indicates the current service list of windows after the
log level is installed.
Common redis service commands.
Uninstall the service: redis-server --service-uninstall
Start the service: redis-server --service-start
Stop the service: redis-server --service-stop
Rename the service: redis-server --service-name name
To rename the service, it needs to be written after the first three parameters, for example:
The following would install and start three separate instances of Redis as a service:
以下将会安装并启动三个不同的Redis实例作服务:
redis-server --service-install --service-name redisService1 --port 10001
redis-server --service-start --service-name redisService1
redis-server --service-install --service-name redisService2 --port 10002
redis-server --service-start --service-name redisService2
redis-server --service-install --service-name redisService3 --port 10003
redis-server --service-start --service-name redisService3
Four: test
start the service
redis-server --service-start
client
Order:
精简模式:
redis-cli.exe
指定模式:
redis-cli.exe -h 127.0.0.1 -p 6379 -a requirepass
(-h 服务器地址 -p 指定端口号 -a 连接数据库的密码[可以在redis.windows.conf中配置],默认无密码)
Test read and write data
The installation test was successful.
Five: Redis desktop management tools
Recommended desktop management tools:
https://redisdesktop.com/download