admin 管理员组文章数量: 887021
Windows上运行Redis
- 一、安装
- 二、配置环境变量
- 三、启动服务
- 四、停止服务
- 五、进入控制台
- 六、英文文档
- 6.1Running Redis as a Service
- 6.2 Installing the Service
- 6.3 Uninstalling the Service
- 6.4 Starting the Service
- 6.5 Stopping the Service
- 6.6 Naming the Service
一、安装
官网:https://redis.io/
官网上是没有windows版可安装的
但是,这么好用的工具,微软做了一个windows版本的:
https://github/microsoftarchive/redis
下载这个 Redis-x64-3.0.504.msi
安装,一路下一步。。。。。
二、配置环境变量
将安装的路径复制,比如: D:\developer\Redis
Windows + R
sysdm.cpl
双击Path
三、启动服务
redis-server --service-start
成功启动后,将显示成功消息,Redis将开始运行。
四、停止服务
redis-server --service-stop
这将停止Redis服务。成功终止后,将显示成功消息,Redis将退出。
五、进入控制台
redis-server --service-start
redis-cli
可看 Windows PC 中打开了哪些端口?
netstat -a
六、英文文档
6.1Running Redis as a Service
If you installed Redis using the MSI package, then Redis was already installed as a Windows service. Nothing further to do. If you would like to change its settings, you can update the redis.windows-service.conf file and then restart the Redis service (Run -> services.msc -> Redis -> Restart).
During installation of the MSI you can either use the installer’s user interface to update the port that Redis listens at and the firewall exception or run it silently without a UI. The following examples show how to install from the command line:
default install (port 6379 and firewall exception ON):
msiexec /i Redis-Windows-x64.msi
set port and turn OFF firewall exception:
msiexec /i Redis-Windows-x64.msi PORT=1234 ADD_FIREWALL_RULE=“”
set port and turn ON firewall exception:
msiexec /i Redis-Windows-x64.msi PORT=1234 ADD_FIREWALL_RULE =1
install with no user interface:
msiexec /quiet /i Redis-Windows-x64.msi
If you did not install Redis using the MSI package, then you still run Redis as a Windows service by following these instructions:
In order to better integrate with the Windows Services model, new command line arguments have been introduced to Redis. These service arguments require an elevated user context in order to connect to the service control manager. If these commands are invoked from a non-elevated context, Redis will attempt to create an elevated context in which to execute these commands. This will cause a User Account Control dialog to be displayed by Windows and may require Administrative user credentials in order to proceed.
6.2 Installing the Service
--service-install
This must be the first argument on the redis-server command line. Arguments after this are passed in the order they occur to Redis when the service is launched. The service will be configured as Autostart and will be launched as “NT AUTHORITY\NetworkService”. Upon successful installation a success message will be displayed and Redis will exit.
This command does not start the service.
For instance:
redis-server --service-install redis.windows-service.conf --loglevel verbose
6.3 Uninstalling the Service
--service-uninstall
This will remove the Redis service configuration information from the registry. Upon successful uninstallation a success message will be displayed and Redis will exit.
This does command not stop the service.
For instance:
redis-server --service-uninstall
6.4 Starting the Service
--service-start
This will start the Redis service. Upon successful start, a success message will be displayed and Redis will begin running.
For instance:
redis-server --service-start
6.5 Stopping the Service
--service-stop
This will stop the Redis service. Upon successful termination a success message will be displayed and Redis will exit.
For instance:
redis-server --service-stop
6.6 Naming the Service
--service-name name
This optional argument may be used with any of the preceding commands to set the name of the installed service. This argument should follow the service-install, service-start, service-stop or service-uninstall commands, and precede any arguments to be passed to Redis via the service-install command.
The following would install and start three separate instances of Redis as a service:
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
版权声明:本文标题:Windows上运行Redis 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1716031577h663166.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论