Hello @yossigo , thank you for adding #8282 , this is the much awaited PR .
we have spent sometime testing that feature on redis:6.2-rc3 from dockerhub with the configuration suggested here #8282 (comment)
at the outset Sentinel vends out the host name of the shard master when we query SENTINEL get-master-addr-by-name mymaster, but after we trigger a failover , it started vending out IPs again, isnt the expectation is to return host name?
here is the yaml spec we used, if it helps you reproduce .
Redis
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
spec:
serviceName: redis
replicas: 5
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
initContainers:
- name: config
image: redis:6.2-rc3
command: [ "bash", "-c" ]
args:
- |
cp /tmp/redis/redis.conf /etc/redis/redis.conf
MASTER_FQDN=redis-0.redis.REDACTED
POD_FQDN=$(hostname -f)
echo "replica-announce-ip $POD_FQDN" >> /etc/redis/redis.conf
echo "replica-announce-port 6379" >> /etc/redis/redis.conf
if [ "$POD_FQDN" = "$MASTER_FQDN" ]; then
echo "this is master, not updating config..."
else
echo "updating replica redis.conf..."
echo "replicaof $MASTER_FQDN 6379" >> /etc/redis/redis.conf
fi
cat /etc/redis/redis.conf
volumeMounts:
- name: redis-config
mountPath: /etc/redis/
- name: config
mountPath: /tmp/redis/
containers:
- name: redis
image: redis:6.2-rc3
command: ["redis-server"]
args: ["/etc/redis/redis.conf"]
ports:
- containerPort: 6379
name: redis
volumeMounts:
- name: data
mountPath: /data
- name: redis-config
mountPath: /etc/redis/
volumes:
- name: redis-config
emptyDir: {}
- name: config
configMap:
name: redis-config
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: scaleio
resources:
requests:
storage: 100Mi
---
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
clusterIP: None
ports:
- port: 6379
targetPort: 6379
name: redis
selector:
app: redis
Sentinel
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: sentinel
spec:
serviceName: sentinel
replicas: 3
selector:
matchLabels:
app: sentinel
template:
metadata:
labels:
app: sentinel
spec:
initContainers:
- name: config
image: redis:6.2-rc3
command: [ "sh", "-c" ]
args:
- |
REDIS_PASSWORD=testpassword
MASTER_FQDN=redis-0.redis.REDACTED
POD_FQDN=$(hostname -f)
echo "port 26379
protected-mode no
sentinel resolve-hostnames yes
sentinel announce-hostnames yes
sentinel announce-ip $POD_FQDN
sentinel announce-port 26379
sentinel monitor mymaster $MASTER_FQDN 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
sentinel parallel-syncs mymaster 1
sentinel auth-pass mymaster $REDIS_PASSWORD
" > /etc/redis/sentinel.conf
cat /etc/redis/sentinel.conf
volumeMounts:
- name: redis-config
mountPath: /etc/redis/
containers:
- name: sentinel
image: redis:6.2-rc3
command: ["redis-server", "/etc/redis/sentinel.conf", "--sentinel"]
ports:
- containerPort: 26379
name: sentinel
volumeMounts:
- name: redis-config
mountPath: /etc/redis/
- name: data
mountPath: /data
volumes:
- name: redis-config
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: scaleio
resources:
requests:
storage: 100Mi
---
apiVersion: v1
kind: Service
metadata:
name: sentinel
spec:
clusterIP: None
ports:
- port: 26379
targetPort: 26379
name: sentinel
selector:
app: sentinel
Hello @yossigo , thank you for adding #8282 , this is the much awaited PR .
we have spent sometime testing that feature on
redis:6.2-rc3from dockerhub with the configuration suggested here #8282 (comment)at the outset Sentinel vends out the host name of the shard master when we query
SENTINEL get-master-addr-by-name mymaster, but after we trigger a failover , it started vending out IPs again, isnt the expectation is to return host name?here is the yaml spec we used, if it helps you reproduce .
Redis
Sentinel