Repository navigation
Description
Hi,
we are testing failure scenarios and have some issues that we can not resolve. We are killing a Redis pod and some seconds later a new pod is spawned with a new IP. The Sentinel and Redis conglomerate has no issue with this scenario as far as we can tell from the logs. The newly joined Redis pod will be detected. Also a simulated Sentinel outage seems not problematic. Our application is also running without issues as long as Redis stays up.
The StackExchange.Redis initially notices that the old Redis pod is not available and reports correctly "StackExchange.Redis.RedisConnectionException: No connection is active/available to service this operation". But there is no switch to one of the other running Redis. He insists on using the old IP of the not anymore existing Redis pod. Even after the new Redis pod is available (with a new IP).
We can reliably produce this situation on all of our Kuberntes clusters. The only thing that currently works is restarting the affected application pod.
It seems we are missing something either in our Sentinel/Redis Cluster config or some secret in StackExchange.Redis ;).
Architecture:
3 Sentinels and 3 Redis in Kubernetes
Redis operator:
https://github.com/spotahome/redis-operator
redis alpine image 5.0.14
StackExchange.Redis version
2.2.79
We tried some client related stuff from other issues with no effect:
- abortConnect and resolveDns had no effect
- Register on ConnectionFailed events and try Configure or PublishReconfigure
Log from starting sequence:
Connecting (sync) on .NET 5.0.11
14:49:40.1726: rfs-redisfailover-persistent.redis.svc.cluster.local:26379,serviceName=mymaster,password=*****,abortConnect=False,resolveDns=True,$NONE=,$APPEND=,$ASKING=,$BGREWRITEAOF=,$BGSAVE=,$BITCOUNT=,$BITOP=,$BITPOS=,$BLPOP=,$BRPOP=,$BRPOPLPUSH=,$CLIENT=,$CLUSTER=,$CONFIG=,$DBSIZE=,$DEBUG=,$DECR=,$DECRBY=,$DEL=,$DISCARD=,$DUMP=,$ECHO=,$EVAL=,$EVALSHA=,$EXEC=,$EXISTS=,$EXPIRE=,$EXPIREAT=,$FLUSHALL=,$FLUSHDB=,$GEOADD=,$GEODIST=,$GEOHASH=,$GEOPOS=,$GEORADIUS=,$GEORADIUSBYMEMBER=,$GET=,$GETBIT=,$GETDEL=,$GETRANGE=,$GETSET=,$HDEL=,$HEXISTS=,$HGET=,$HGETALL=,$HINCRBY=,$HINCRBYFLOAT=,$HKEYS=,$HLEN=,$HMGET=,$HMSET=,$HSCAN=,$HSET=,$HSETNX=,$HSTRLEN=,$HVALS=,$INCR=,$INCRBY=,$INCRBYFLOAT=,$KEYS=,$LASTSAVE=,$LATENCY=,$LINDEX=,$LINSERT=,$LLEN=,$LPOP=,$LPUSH=,$LPUSHX=,$LRANGE=,$LREM=,$LSET=,$LTRIM=,$MEMORY=,$MGET=,$MIGRATE=,$MONITOR=,$MOVE=,$MSET=,$MSETNX=,$MULTI=,$OBJECT=,$PERSIST=,$PEXPIRE=,$PEXPIREAT=,$PFADD=,$PFCOUNT=,$PFMERGE=,$PSETEX=,$PTTL=,$PUBLISH=,$PUBSUB=,$QUIT=,$RANDOMKEY=,$READONLY=,$READWRITE=,$RENAME=,$RENAMENX=,$REPLICAOF=,$RESTORE=,$RPOP=,$RPOPLPUSH=,$RPUSH=,$RPUSHX=,$SADD=,$SAVE=,$SCAN=,$SCARD=,$SCRIPT=,$SDIFF=,$SDIFFSTORE=,$SELECT=,$SET=,$SETBIT=,$SETEX=,$SETNX=,$SETRANGE=,$SINTER=,$SINTERSTORE=,$SISMEMBER=,$SLAVEOF=,$SLOWLOG=,$SMEMBERS=,$SMOVE=,$SORT=,$SPOP=,$SRANDMEMBER=,$SREM=,$STRLEN=,$SUNION=,$SUNIONSTORE=,$SSCAN=,$SWAPDB=,$SYNC=,$TIME=,$TOUCH=,$TTL=,$TYPE=,$UNLINK=,$UNWATCH=,$WATCH=,$XACK=,$XADD=,$XCLAIM=,$XDEL=,$XGROUP=,$XINFO=,$XLEN=,$XPENDING=,$XRANGE=,$XREAD=,$XREADGROUP=,$XREVRANGE=,$XTRIM=,$ZADD=,$ZCARD=,$ZCOUNT=,$ZINCRBY=,$ZINTERSTORE=,$ZLEXCOUNT=,$ZPOPMAX=,$ZPOPMIN=,$ZRANGE=,$ZRANGEBYLEX=,$ZRANGEBYSCORE=,$ZRANK=,$ZREM=,$ZREMRANGEBYLEX=,$ZREMRANGEBYRANK=,$ZREMRANGEBYSCORE=,$ZREVRANGE=,$ZREVRANGEBYLEX=,$ZREVRANGEBYSCORE=,$ZREVRANK=,$ZSCAN=,$ZSCORE=,$ZUNIONSTORE=,$UNKNOWN=
14:49:40.1785: Using DNS to resolve 'rfs-redisfailover-persistent.redis.svc.cluster.local'...
14:49:40.1897: 'rfs-redisfailover-persistent.redis.svc.cluster.local' => 10.98.84.184
14:49:40.2282: 10.98.84.184:26379/Interactive: Connecting...
14:49:40.2585: 10.98.84.184:26379: BeginConnectAsync
14:49:40.2682: 1 unique nodes specified
14:49:40.2695: 10.98.84.184:26379: OnConnectedAsync init (State=Connecting)
14:49:40.2698: Allowing 1 endpoint(s) 00:00:05 to respond...
14:49:40.2764: 10.98.84.184:26379/Interactive: Connected
14:49:40.2772: Awaiting 1 available task completion(s) for 5000ms, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=2,Free=32765,Min=1,Max=32767)
14:49:40.2813: 10.98.84.184:26379: Server handshake
14:49:40.2814: 10.98.84.184:26379: Authenticating (password)
14:49:40.3329: 10.98.84.184:26379: Auto-configuring...
14:49:40.3352: 10.98.84.184:26379: Sending critical tracer (handshake): PING
14:49:40.3355: 10.98.84.184:26379/Interactive: Writing: PING
14:49:40.3355: 10.98.84.184:26379: Flushing outbound buffer
14:49:40.3356: 10.98.84.184:26379: OnEstablishingAsync complete
14:49:40.3379: 10.98.84.184:26379: Starting read
14:49:40.4312: 10.98.84.184:26379: Auto-configured (SENTINEL) server-type: sentinel
14:49:40.4315: 10.98.84.184:26379: Auto-configured (INFO) version: 5.0.14
14:49:40.4315: 10.98.84.184:26379: Auto-configured (INFO) server-type: sentinel
14:49:40.4322: Response from 10.98.84.184:26379/Interactive / PING: SimpleString: PONG
14:49:40.4338: 10.98.84.184:26379: OnConnectedAsync completed (From command: PING)
14:49:40.4355: All 1 available tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=1,Max=32767)
14:49:40.4356: 10.98.84.184:26379: Endpoint is ConnectedEstablished
14:49:40.4356: 10.98.84.184:26379: Returned with success as Sentinel primary (Source: From command: PING)
14:49:40.4469: Election: Single master detected: 10.98.84.184:26379
14:49:40.4470: 10.98.84.184:26379: Clearing as RedundantMaster
14:49:40.4495: 10.98.84.184:26379: Sentinel v5.0.14, master; keep-alive: 00:01:00; int: ConnectedEstablished; sub: ConnectedEstablished, 1 active
14:49:40.4521: 10.98.84.184:26379: int ops=5, qu=0, qs=0, qc=0, wr=0, socks=1; sub ops=3, qu=0, qs=0, qc=0, wr=0, subs=1, socks=1
14:49:40.4553: 10.98.84.184:26379: Circular op-count snapshot; int: 0+5=5 (0.50 ops/s; spans 10s); sub: 0+3=3 (0.30 ops/s; spans 10s)
14:49:40.4555: Sync timeouts: 0; async timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
14:49:40.4556: Starting heartbeat...
Connecting (sync) on .NET 5.0.11
14:49:40.5619: 10.244.3.188:6379,10.244.2.245:6379,10.244.1.16:6379,serviceName=mymaster,password=*****,abortConnect=False,resolveDns=True
14:49:40.5620: 10.244.3.188:6379/Interactive: Connecting...
14:49:40.5622: 10.244.3.188:6379: BeginConnectAsync
14:49:40.5629: 10.244.2.245:6379/Interactive: Connecting...
14:49:40.5629: 10.244.3.188:6379/Interactive: Connected
14:49:40.5629: 10.244.3.188:6379: Server handshake
14:49:40.5629: 10.244.3.188:6379: Authenticating (password)
14:49:40.5630: 10.244.2.245:6379: BeginConnectAsync
14:49:40.5640: 10.244.1.16:6379/Interactive: Connecting...
14:49:40.5642: 10.244.1.16:6379: BeginConnectAsync
14:49:40.5645: 3 unique nodes specified
14:49:40.5645: 10.244.3.188:6379: OnConnectedAsync init (State=ConnectedEstablishing)
14:49:40.5645: 10.244.2.245:6379: OnConnectedAsync init (State=Connecting)
14:49:40.5645: 10.244.1.16:6379: OnConnectedAsync init (State=Connecting)
14:49:40.5645: Allowing 3 endpoint(s) 00:00:05 to respond...
14:49:40.5646: Awaiting 3 available task completion(s) for 5000ms, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=1,Max=32767)
14:49:40.5874: 10.244.3.188:6379: Setting client name: tenantservice-d45c7d58d-r8rtl
14:49:40.5876: 10.244.3.188:6379: Auto-configuring...
14:49:40.5887: 10.244.3.188:6379: Sending critical tracer (handshake): ECHO
14:49:40.5888: 10.244.3.188:6379/Interactive: Writing: ECHO
14:49:40.5890: 10.244.3.188:6379: Flushing outbound buffer
14:49:40.5890: 10.244.3.188:6379: OnEstablishingAsync complete
14:49:40.5890: 10.244.3.188:6379: Starting read
14:49:40.5918: 10.244.2.245:6379/Interactive: Connected
14:49:40.5918: 10.244.2.245:6379: Server handshake
14:49:40.5918: 10.244.2.245:6379: Authenticating (password)
14:49:40.5918: 10.244.2.245:6379: Setting client name: tenantservice-d45c7d58d-r8rtl
14:49:40.5919: 10.244.2.245:6379: Auto-configuring...
14:49:40.5919: 10.244.2.245:6379: Sending critical tracer (handshake): ECHO
14:49:40.5919: 10.244.2.245:6379/Interactive: Writing: ECHO
14:49:40.5919: 10.244.2.245:6379: Flushing outbound buffer
14:49:40.5919: 10.244.2.245:6379: OnEstablishingAsync complete
14:49:40.5919: 10.244.2.245:6379: Starting read
14:49:40.5922: 10.244.1.16:6379/Interactive: Connected
14:49:40.5922: 10.244.1.16:6379: Server handshake
14:49:40.5924: 10.244.1.16:6379: Authenticating (password)
14:49:40.5924: 10.244.1.16:6379: Setting client name: tenantservice-d45c7d58d-r8rtl
14:49:40.5924: 10.244.1.16:6379: Auto-configuring...
14:49:40.5924: 10.244.1.16:6379: Sending critical tracer (handshake): ECHO
14:49:40.5925: 10.244.1.16:6379/Interactive: Writing: ECHO
14:49:40.5925: 10.244.1.16:6379: Flushing outbound buffer
14:49:40.5925: 10.244.1.16:6379: OnEstablishingAsync complete
14:49:40.5925: 10.244.1.16:6379: Starting read
14:49:40.5931: 10.244.3.188:6379: Auto-configured (CONFIG) read-only replica: true
14:49:40.5931: 10.244.2.245:6379: Auto-configured (CONFIG) read-only replica: true
14:49:40.5932: 10.244.3.188:6379: Auto-configured (CONFIG) databases: 16
14:49:40.5933: 10.244.3.188:6379: Auto-configured (INFO) version: 5.0.14
14:49:40.5934: 10.244.3.188:6379: Auto-configured (INFO) server-type: standalone
14:49:40.5934: 10.244.2.245:6379: Auto-configured (CONFIG) databases: 16
14:49:40.5934: 10.244.1.16:6379: Auto-configured (CONFIG) read-only replica: true
14:49:40.5935: 10.244.2.245:6379: Auto-configured (INFO) version: 5.0.14
14:49:40.5935: 10.244.1.16:6379: Auto-configured (CONFIG) databases: 16
14:49:40.5935: 10.244.3.188:6379: Auto-configured (INFO) role: master
14:49:40.5936: 10.244.1.16:6379: Auto-configured (INFO) version: 5.0.14
14:49:40.5936: 10.244.1.16:6379: Auto-configured (INFO) server-type: standalone
14:49:40.5936: 10.244.2.245:6379: Auto-configured (INFO) server-type: standalone
14:49:40.5936: 10.244.1.16:6379: Auto-configured (INFO) role: replica
14:49:40.5937: 10.244.2.245:6379: Auto-configured (INFO) role: replica
14:49:40.5940: Response from 10.244.1.16:6379/Interactive / ECHO: BulkString: 16 bytes
14:49:40.5940: Response from 10.244.2.245:6379/Interactive / ECHO: BulkString: 16 bytes
14:49:40.5941: Response from 10.244.3.188:6379/Interactive / ECHO: BulkString: 16 bytes
14:49:40.6037: 10.244.1.16:6379: OnConnectedAsync completed (From command: ECHO)
14:49:40.6038: 10.244.2.245:6379: OnConnectedAsync completed (From command: ECHO)
14:49:40.6038: 10.244.3.188:6379: OnConnectedAsync completed (From command: ECHO)
14:49:40.6039: All 3 available tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=1,Max=32767)
14:49:40.6039: 10.244.3.188:6379: Endpoint is ConnectedEstablished
14:49:40.6039: 10.244.2.245:6379: Endpoint is ConnectedEstablished
14:49:40.6040: 10.244.1.16:6379: Endpoint is ConnectedEstablished
14:49:40.6040: Election: Gathering tie-breakers...
14:49:40.6040: 10.244.3.188:6379: Requesting tie-break (Key="__Booksleeve_TieBreak")...
14:49:40.6097: 10.244.3.188:6379/Interactive: Writing: GET __Booksleeve_TieBreak
14:49:40.6101: 10.244.2.245:6379: Requesting tie-break (Key="__Booksleeve_TieBreak")...
14:49:40.6102: 10.244.2.245:6379/Interactive: Writing: GET __Booksleeve_TieBreak
14:49:40.6103: 10.244.1.16:6379: Requesting tie-break (Key="__Booksleeve_TieBreak")...
14:49:40.6103: 10.244.1.16:6379/Interactive: Writing: GET __Booksleeve_TieBreak
14:49:40.6103: 10.244.3.188:6379: Returned with success as Standalone primary (Source: From command: ECHO)
14:49:40.6103: 10.244.2.245:6379: Returned with success as Standalone replica (Source: From command: ECHO)
14:49:40.6103: 10.244.1.16:6379: Returned with success as Standalone replica (Source: From command: ECHO)
14:49:40.6104: Waiting for tiebreakers...
14:49:40.6104: Awaiting 3 tiebreaker task completion(s) for 4955ms, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=1,Max=32767)
14:49:40.6122: Response from 10.244.3.188:6379/Interactive / GET __Booksleeve_TieBreak: (null)
14:49:40.6122: Response from 10.244.1.16:6379/Interactive / GET __Booksleeve_TieBreak: (null)
14:49:40.6123: Response from 10.244.2.245:6379/Interactive / GET __Booksleeve_TieBreak: (null)
14:49:40.6132: All 3 tiebreaker tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=1,Max=32767)
14:49:40.6142: Election: 10.244.3.188:6379 had no tiebreaker set
14:49:40.6143: Election: 10.244.2.245:6379 had no tiebreaker set
14:49:40.6143: Election: 10.244.1.16:6379 had no tiebreaker set
14:49:40.6143: Election: Single master detected: 10.244.3.188:6379
14:49:40.6143: 10.244.3.188:6379: Clearing as RedundantMaster
14:49:40.6143: 10.244.3.188:6379: Standalone v5.0.14, master; 16 databases; keep-alive: 00:01:00; int: ConnectedEstablished; sub: ConnectedEstablished, 1 active
14:49:40.6143: 10.244.3.188:6379: int ops=11, qu=0, qs=0, qc=0, wr=0, socks=1; sub ops=4, qu=0, qs=0, qc=0, wr=0, subs=1, socks=1
14:49:40.6143: 10.244.3.188:6379: Circular op-count snapshot; int: 0+11=11 (1.10 ops/s; spans 10s); sub: 0+4=4 (0.40 ops/s; spans 10s)
14:49:40.6143: 10.244.2.245:6379: Standalone v5.0.14, replica; 16 databases; keep-alive: 00:01:00; int: ConnectedEstablished; sub: ConnectedEstablished, 1 active
14:49:40.6144: 10.244.2.245:6379: int ops=11, qu=0, qs=0, qc=0, wr=0, socks=1; sub ops=4, qu=0, qs=0, qc=0, wr=0, subs=1, socks=1
14:49:40.6144: 10.244.2.245:6379: Circular op-count snapshot; int: 0+11=11 (1.10 ops/s; spans 10s); sub: 0+4=4 (0.40 ops/s; spans 10s)
14:49:40.6144: 10.244.1.16:6379: Standalone v5.0.14, replica; 16 databases; keep-alive: 00:01:00; int: ConnectedEstablished; sub: ConnectedEstablished, 1 active
14:49:40.6144: 10.244.1.16:6379: int ops=11, qu=0, qs=0, qc=0, wr=0, socks=1; sub ops=4, qu=0, qs=0, qc=0, wr=0, subs=1, socks=1
14:49:40.6144: 10.244.1.16:6379: Circular op-count snapshot; int: 0+11=11 (1.10 ops/s; spans 10s); sub: 0+4=4 (0.40 ops/s; spans 10s)
14:49:40.6144: Sync timeouts: 0; async timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
14:49:40.6144: Starting heartbeat...```
Activity
NickCraver commentedon Oct 21, 2021
I see in your connection string there's a
resolveDns=True, this will very explicitly resolve DNS when connecting initially and then use the IP as your endpoint, never following. If this isn't used, we'll rely on DNS when reconnecting but there may be caching on the host in place. Do you know what Sentinel is returning and if such a cache is in play? With your example, it's resolving, so I can't tell - see this section:...that's resolving endpoints before the message, so I'm not sure if that's raw Sentinel outputting IPs (which may be Sentinel config, and it not being aware), or if it's DNS and we're hard resolving it due to the true argument.
ThomasTosik commentedon Oct 22, 2021
I tested it out this time with
resolveDns=False. No change in the behaviour. I have to talk with Ops about the DNS caching. Will come back to you.When i trigger the failover i can see in all 3 Sentinels logs the change (old ip 10.244.2.39 and new ip 10.244.3.188)
Sentinel log:
Some addtional infos:
Con string:
rfs-redisfailover-persistent.redis.svc.cluster.local:26379,abortConnect=false,resolveDns=trueKubernetes Svc
Endpoints behind address:
All ips of the redis cluster:
The log again
ThomasTosik commentedon Nov 12, 2021
So our Ops says there should not be any DNS caching issue. Also we can run the system in the broken state for days and nothing happens. Is there any chance of getting more log to see if the client is getting the psubscribe messages from sentinel?
ThomasTosik commentedon Nov 15, 2021
So i decided to tap into the events of the redis connection and log everything out.
Ips of Redis and Sentinels before deleting Redis pod "rfr-redisfailover-persistent-0 "
After deletion:
10.244.2.233 => 10.244.2.18
Redis event log of my service:
It is reacting to the change.
Sentinel #1 log:
Sentinel #1 sees the redis pod deletion "14:39:22.213 # +sdown master mymaster 10.244.2.237 6379" and my service also sees this change at the same time. "10.244.1.53" is becoming the new master and the newly spawned redis is becoming a slave as 10.244.2.18. But my service is still trying to connect idefnitently to the old non-existing slave 10.244.2.237.
ThomasTosik commentedon Jan 17, 2022
Recently our Ops updated the systems from Ubuntu 18 to 20. No change in behaviour.
lord-kyron commentedon Mar 23, 2022
@ThomasTosik, we are also experiencing the same problems in all our Kubernetes clusters. Did you manage to find some solution for it?
ThomasTosik commentedon Mar 23, 2022
@lord-kyron: Sadly no. We recently updated several componets (Redis, Operator and Nuget) and i wanted to test if this helps. Have to find time for a test.
A possible workaround via dispose of the connection does not work for us (could be viable for you) because several external componets can not cope with a sudden dispose.
JotaDobleEse commentedon Jan 31, 2023
@ThomasTosik any news on this? I'm having a problem like this.
ThomasTosik commentedon Jan 31, 2023
@JotaDobleEse: Sadly no, we are fairly up-to-date on all of our components in our tests: Kubernetes, OS, Alpine 3.17 Container, DotNet 7, this lib itself, different cloud providers (custom, aws, ionos), Redis 7.0.6, Redis Spotahome Operator. It fails consitently and can not recover.
NickCraver commentedon Feb 9, 2023
Saw this from the bump - a lot of changes have been made to handle a variety of scenarios in the client - if this still reproducing on a later version? We want to resolve this case for sure, but would need details from the latest library version for the scenario that's happening. We don't use pods at all here, so not sure what the config vs. pods mismatch is. For example: is the connection string you're using (the DNS name) the endpoint that's changing? If so, resolveDns will indeed cache forever and we're thinking about altering this behavior, your info would help on decisions!
ThomasTosik commentedon Feb 10, 2023
I made a clean new test with StackExchange.Redis 2.6.90. My connection string is the following: "rfs-redisfailover-persistent.redis.svc.cluster.local:26379,abortConnect=false". Since resolveDns is not set it defaults to false.
The result is still the same failure.
The DNS name entries itself are not changing, only the ips behind that.
This is the status of the redis part of the cluster before i simulate an outage:
This is the status after the simulated failure:
Notice "rfr-redisfailover-persistent-2" which changed its ip from 10.244.1.246 to 10.244.1.12.
The logging from Redis and Sentinel is implying that they detected the failure scenario and acted accordingly; electing a new Redis master. In my case rfr-redisfailover-persistent-0 (10.244.4.158). I can post this logging if helpful.
My own application can not access redis anymore because its trying to connect to the non existent ip 10.244.1.246, the initial redis master that i simulated the failure with.
The logging of the events seem to imply that StackExchange.Redis is getting a change event (i registered my logging to the events). The new master IP is also seen to be used (Endpoint: [10.244.4.158:6379]):
Yet it insists on connecting to the none existing redis master with the old ip (10.244.1.246).
Either Sentinel is not sending the required events to start an update chain in StackExchange.Redis or....
I can provide more logging if helpful or test some other settings/configs.
kartikb-io commentedon Mar 7, 2023
Hi, first of all sorry if this is the wrong place to ask this.
I'm a network/cloud infra engineer, not a dev and I don't understand .NET at all, but I've been trying to get the Google microservices demo working with Redis Enterprise and I am hitting the issue where the DNS name is the same but the IPs keep changing due to pods/svcs dying in failure scenarios, this is the code of the container/pod to connect to the Redis DNS name (passed through env variable REDIS_ADDR), if I delete and recreate the pod it resolves DNS and picks the new IP up otherwise it has cached the old IP, this seems expected based on the behaviour of reconnect never triggering DNS resolution. Again with no coding knowledge, I think that the resolveDNS value is default here and thus false which is what we want.
Here is the file with the code that the container/pod is building the executable out of, can someone please help me to code a workaround to force DNS resolution on reconnect?
https://github.com/GoogleCloudPlatform/microservices-demo/blob/main/src/cartservice/src/Startup.cs
Specifically, how do I set resolveDNS=false option explicitly (if I need to) in the AddStackExchangeRedisCache options in this code?
Also, I am not using Sentinel directly configured by myself but with default values using Redis enterprise with the operator as per https://docs.redis.com/latest/kubernetes/re-clusters/create-aa-database/
to set up in Kubernetes with two clusters in Azure vnet peered.
Thanks much in advance
ThomasTosik commentedon Mar 8, 2023
You can pass this config via the redis uri connection string. E.g. "redis:26379,resolveDNS=false"
ThomasTosik commentedon Mar 22, 2023
What we tried out with our Ops team is to use the Calico CNI which allows to define fixed IPs. This helped a little bit but not for all situations. Especially when Node and NodePool changes are involved.
Also changing CNIs (which support fixed ips) is not necessarily an easy path for some production scenarios.
Coelurus commentedon Mar 26, 2025
Hey @ThomasTosik hi from 2025. Have u managed to solve this issue? i just came across it and my oh my it does not look really promising for me.
ThomasTosik commentedon Mar 27, 2025
@Coelurus: Sadly no, we have gone with a complete different system and ditched Redis. Although, i am not 100% sure if its really a connector, Redis issue or even our own fault.
jakoss commentedon Oct 8, 2025
We've stumbled on the same issue now, that is really a killer problem. @NickCraver have you thought about changing that behavior?
fix(sentinel): re-elect primary on failover between already-known nod…
fix(sentinel): re-elect primary on failover between already-known nod…
Vlad-Zaytsev commentedon Aug 19, 2026
It looks like the bug is easy to reproduce in Docker (assuming this is the same bug).
A docker-compose stand with a master, one replica, a sentinel, and a test application.
Start everything up.
The sentinel announces one replica (correct).
Then we stop the replica, create a dummy container to guarantee the IP changes, and start the replica again.
Now the sentinel announces two replicas — the new one and the old one.
Meanwhile the test application still knows only about the old replica.
Since querying master/replica list is a cheap operation, would it make sense to refresh it periodically?
Sentinel: re-resolve the primary when it is demoted on a healthy conn…
Merge main into v4 (19 commits to 2026-10-23), with the v3-only fixes…