How to install Redis Sentinel as a Windows service?

9.5k views Asked by At

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

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

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

This command installs the 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 caught. error code=1063, message = StartServiceCtrlDispatcherA failed: unknown error

Am I missing something here? Please someone help me start this service make it work properly.

4

There are 4 answers

0
Tedford On

I am using v3.0.501 and ran into the two issues below. While present it caused the service to fail on start without an error written to either the file log or the Event Log.

  1. The configuration file must be the last parameter of the command line. If another parameter was last, such as --service-name, it would run fine when invoked the command line but would consistently fail went started as a service.
  2. Since the service installs a Network Service by default, ensure that it has access to the directory where the log file will be written.

Once these two items were accounted for the redis as a service run smooth as silk.

0
bmalec On

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 that command the installed service wouldn't start: it would immediately fail with error 1067, "The process terminated unexpectedly." Looking at service entry I'm guessing the problem is that the --service-name parameter isn't being filtered and ends up as part of the service executable path.

What I did find to work is installing the service manually with 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 that path will have to reflect where you've installed redis-server.exe. Also after the service installed I edited the service entry so Redis Sentinel would run under the Network Service account.

0
Focker On

I had the same problem, and mine was related to my sentinel config. A number of articles I have found have some incorrect examples, so my service install would not work until the configuration was correct. Anyway, here is what you need at a minimum for your sentinel config (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 that setup, the original Redis service command above will work.

1
Robin Ding On

Recently, I have found a way how to setup windows service for Redis and Sentinel. During my setup, I encountered similar problem. I finally figured it out: it was caused by the configuration file path.

I have put all my configuration into my github project: https://github.com/dingyuliang/Windows-Redis-Sentinel-Config