Last active
July 6, 2016 17:02
-
-
Save yholkamp/760f9186794a974bdefc to your computer and use it in GitHub Desktop.
Connect to Redis master with Sentinel-powered master discovery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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