How do I install Redis Sentinel as a Windows service?

I am trying to set up redis sentinel as a windows service on an Azure VM (IaaS).

I am using MS OpenTech port for Redis for Windows and run the following command ...

redis-server --service-install --service-name rdsent redis.sentinel.conf --sentinel

This command installs a service on my system, but when I try to start this service either through the services control panel or through the following command ...

redis-server --service-run --service-name rdsent redis.sentinel.conf --sentinel

Then the service fails to start with the following error ...

HandleServiceCommands: System error. error code = 1063, message = StartServiceCtrlDispatcherA failed: unknown error

Am I missing something? Please help me get this service started to work properly.

+3


source to share


4 answers


According to MSOpenTech, the following command should install Redis Sentinel as a service:

redis-server --service-install --service-name Sentinel1 sentinel.1.conf --sentinel

      

But when I used this command, the installed service did not start: it exits immediately with error 1067: "The process ended unexpectedly". Looking at the service entry, I guess the problem is that the -service-name parameter is not filtered and ends up as part of the service execution path.



What I found to work is installing the service manually using the SC command:

SC CREATE Sentinel1 binpath= "\"C:\Program Files\Redis\redis-server.exe\" --service-run sentinel.1.conf --sentinel"

      

Don't forget the required space after "binpath =" and obviously this path should reflect where you installed redis-server.exe. Also, after installing the service, I edited the service record so that Redis Sentinel will run under the Network Service account.

+2


source


I had the same problem and mine was related to my sentinel configuration. A number of articles I've found have some wrong examples, so my service installation won't work until the configuration is correct. Anyway, here's what you need at least for your sentinel configuration (for Windows Redis 2.8.17):

    sentinel monitor <name of redis cache>  <server IP> <port> 2
    sentinel down-after-milliseconds <name of redis cache> 4000
    sentinel failover-timeout <name of redis cache> 180000
    sentinel parallel-syncs <name of redis cache> 1

      



Once you have this setup, the original Redis command will work.

+2


source


I am using v3.0.501 and faced two problems below. Even though it was present, it caused the service to fail on startup with no error written to either the file log or event log.

  • The config file should be the last command line parameter. If the last parameter was the last one, such as -service-name, it will work fine when invoked on the command line, but will be sequentially started as a service.
  • Since the service installs Network Service

    by default, make sure it has access to the directory where the log file will be written.

After these two elements were accounted for as redis, since the service runs smoothly like silk.

0


source


I recently found a way to set up a Windows Service for Redis and Sentinel. During my installation, I ran into a similar issue. I finally figured it out: it was called by a config file.

I have included all my config in my github project: https://github.com/dingyuliang/Windows-Redis-Sentinel-Config

0


source







All Articles