Skip to content

Instantly share code, notes, and snippets.

@yholkamp
Last active July 6, 2016 17:02
Show Gist options
  • Save yholkamp/760f9186794a974bdefc to your computer and use it in GitHub Desktop.
Save yholkamp/760f9186794a974bdefc to your computer and use it in GitHub Desktop.
Connect to Redis master with Sentinel-powered master discovery
# Provide the IP/port to any Redis server currently in a Sentinel cluster
master=$(redis-cli -h 10.0.1.57 -p 26379 SENTINEL get-master-addr-by-name redis-cluster)
arr=()
while read -r line; do
arr+=("$line")
done <<< "$master"
echo "Redis master is at ${arr[0]}:${arr[1]}"
# Connect to the master node with redis-cli:
redis-cli -h ${arr[0]} -p ${arr[1]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment