redis for windows 服务安装

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ygz5175526/article/details/72874758

Running Redis as a ServiceRedis作为一个服务运行

 

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).

如果您使用MSI软件包安装了Redis,则Redis已经作为Windows服务安装。无需做其他事情。如果您想更改其设置,您可以更新redis.windows-service.conf文件,然后重新启动Redis服务(运行 - > services.msc - > Redis - >重新启动)。

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:

在安装MSI期间,您可以使用安装程序的用户界面更新Redis侦听的端口和防火墙异常,或者在没有UI的情况下静默运行它。以下示例说明如何从命令行安装:

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:

如果您没有使用MSI软件包安装Redis,则您仍然按照以下说明将Redis作为Windows服务运行:

 

 

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.

为了更好地与Windows服务模型集成,已经向Redis引入了新的命令行参数。这些服务参数需要提升的用户上下文才能连接到服务控制管理器。如果从非提升的上下文调用这些命令,Redis将尝试创建一个提升的上下文来执行这些命令。这将导致Windows显示用户帐户控制对话框,并且可能需要管理用户凭据才能继续。

 

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.

这必须是redis-server命令行上的第一个参数。此后的参数将按照Redis在启动服务时发生的顺序传递。该服务将配置为自动启动,并将作为“NT AUTHORITY \ NetworkService”启动。成功安装后,将显示成功消息,Redis将退出。

This command does not start the service.此命令不启动服务。

For instance例如:

redis-server --service-install redis.windows-service.conf --loglevel verbose

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.这将从注册表中删除Redis服务配置信息。成功卸载后,将显示成功消息,Redis将退出。

This does command not stop the service. 此命令不停止服务。

For instance(例如):

redis-server --service-uninstall

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

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

 

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.

此可选参数可与上述任何命令一起使用,以设置已安装服务的名称。此参数应遵循service-installservice-startservice-stopservice-uninstall命令,并且先于通过service-install命令传递给Redis的任何参数。

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

 

阅读更多
换一批

没有更多推荐了,返回首页