redis-operator
redis-operator copied to clipboard
Dynamically GetMasterIP(replication) methods without restarting sentinel
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
What version of redis-operator are you using?
redis-operator version: v0.14.0
Additional context
https://github.com/spotahome/redis-operator/blob/fe8090ac7291ee53ac30e534fa1cc03e5759fd10/operator/redisfailover/service/check.go#L266
Use script to get MasterIP method
if [ -s "$REDIS_TLS_CA_KEY" ]; then
readonly REDIS_CLI="redis-cli --tls --cacert $REDIS_TLS_CA_KEY"
else
readonly REDIS_CLI="redis-cli"
fi
readonly REPLSVC="${REPLICATION:-repl}"
until $REDIS_CLI -h "$MASTER_HOST" -p "$MASTER_PORT" info Keyspace 2>/dev/null; do
eval "$($REDIS_CLI -h "$REPLSVC" info Replication 2>/dev/null | grep "master_[hp]o[rs]t:" | awk -F: '{sub("\r$", "");printf("%s=%s\n"),toupper($1),$2}')"
sleep 1
done
echo "sentinel monitor ${MASTER_GROUP_NAME:-myMaster} ${IP:-$MASTER_HOST} ${PORT:-$MASTER_PORT} ${QUORUM:-2}"
https://github.com/muicoder/redis-operator/blob/action/chart/files/entrypoint.sh#L99
Tested for Chart
https://github.com/muicoder/redis-operator/compare/master...action