Search code examples
redisredis-sentinelredis-server

How to start `redis-sentinel` server successfully


Sorry redis newbie here.

When I run redis-sentinel

42533:X 10 Nov 21:21:30.345 # Warning: no config file specified, using 
the default config. In order to specify a config file use redis- 
sentinel /path/to/sentinel.conf
42533:X 10 Nov 21:21:30.346 * Increased maximum number of open files to 
10032 (it was originally set to 7168).
Redis 3.0.4 (00000000/0) 64 bit

Running in sentinel mode
Port: 26379
PID: 42533
http://redis.io

42533:X 10 Nov 21:21:30.347 # Sentinel runid is 
733213860cf470431c7441e5d6aaf9ed9b2d7c2f
42533:X 10 Nov 21:21:30.347 # Sentinel started without a config file. 
Exiting...

What am I missing? Do I need a configuration file? If so where should my /path/to/sentinel.conf be?


Solution

  • It is mandatory to use a configuration file when running Sentinel, as this file will be used by the system in order to save the current state that will be reloaded in case of restarts. Sentinel will simply refuse to start if no configuration file is given or if the configuration file path is not writable.

    you can run Sentinel with the following command line:

    redis-sentinel /path/to/sentinel.conf
    

    Otherwise you can use directly the redis-server executable starting it in Sentinel mode:

    redis-server /path/to/sentinel.conf --sentinel
    

    You can put the file anywhere you want, just make sure you are providing the right path for that. For example, if you are in linux and if the file is inside your home directory, then the command will be

    redis-sentinel ~/sentinel.conf