Skip to content

Instantly share code, notes, and snippets.

@selcukusta
Created April 13, 2018 21:55
Show Gist options
  • Select an option

  • Save selcukusta/754ce8e1cdbf5221ea3281bf505ae68d to your computer and use it in GitHub Desktop.

Select an option

Save selcukusta/754ce8e1cdbf5221ea3281bf505ae68d to your computer and use it in GitHub Desktop.
#!/bin/sh
tee /etc/redis/sentinel.conf <<EOF
port 26379
daemonize yes
logfile "/var/log/sentinel.log"
pidfile "var/run/sentinel.pid"
dir "/var/lib/redis/sentinel"
sentinel monitor docker-cluster $MASTER_HOST 6379 $SENTINEL_QUORUM
sentinel down-after-milliseconds docker-cluster $SENTINEL_DOWN_AFTER
sentinel parallel-syncs docker-cluster 1
sentinel failover-timeout docker-cluster $SENTINEL_FAILOVER
EOF
redis-sentinel /etc/redis/sentinel.conf
if [ "$IS_SLAVE" == true ]; then
redis-server --slaveof $MASTER_HOST 6379
else
redis-server
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment