Uses: ENTRYPOINT ["redis-sentinel", "/etc/redis/sentinel.conf"]
To configure sentinel.conf at run-time
docker run joshula/redis-sentinel --[config A] --[config B]
Important: the you must bind ports (-p) and set the (sentinel announce-ip) and (sentinel-announce-port) parameters in sentinel.conf for Sentinel to work in a container environment.
Here's an example of what that looks like:
docker run -p 26379:26379 joshula/redis-sentinel --sentinel announce-ip 126.96.36.199 --sentinel announce-port 26379
Finally, here's the dockerfile
FROM centos:latest # Install dependencies RUN yum -y install make gcc cc tar # Install Redis RUN \ cd /tmp && \ curl -O http://download.redis.io/redis-stable.tar.gz && \ tar xvzf redis-stable.tar.gz && \ cd redis-stable && \ make && \ make install && \ cp -f src/redis-sentinel /usr/local/bin && \ mkdir -p /etc/redis && \ cp -f *.conf /etc/redis && \ rm -rf /tmp/redis-stable* && \ sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf && \ sed -i 's/^\(daemonize .*\)$/# \1/' /etc/redis/redis.conf && \ sed -i 's/^\(dir .*\)$/# \1\ndir \/data/' /etc/redis/redis.conf && \ sed -i 's/^\(logfile .*\)$/# \1/' /etc/redis/redis.conf # Cleanup dependencies RUN yum -y erase gcc cc tar # Define mountable directories VOLUME ["/data"] # Define working directory WORKDIR /data # Define entrypoint ENTRYPOINT ["redis-sentinel", "/etc/redis/sentinel.conf"] # Expose ports EXPOSE 26379
Hi folks, I havne't looked at this in a while. I've switched completely to Redis Cluster for both Availability and Scale. I'm happy to change whatever you need so this works for you… but you'll have to be really specific. The config files and run-time commands live with you, really the only thing I can update is the dockerfile - what exactly would you like me to change in it?
Have you had a chance to fix the quoting of the settings that savemu mentioned?
Hi joshula, i'm running in a similar issue, the reason is pretty simple you are quoting the settings that are passed to sentinel
bash-3.2$ docker run --name=redis-sentinel -p 26379:26379 joshula/redis-sentinel --sentinel 'monitor cluster1 192.168.99.100 6379 2' --help *** FATAL CONFIG FILE ERROR *** Reading the configuration file, at line 183 >>> 'sentinel "monitor cluster1 192.168.99.100 6379 2"'
but sentinel accept settings only without quotes
Hey joshula, I'm a little confused when it comes to specifying the sentinel config file. If I have a config file locally at
/conf/redis-sentinel/sentinel.conf how do I specify that in the
docker run command?
I see your examples as --[config A] but everything I try isn't working. I keep getting:
*** FATAL CONFIG FILE ERROR *** Reading the configuration file, at line 183
Any help is much appreciated!