JedisSentinelPool 在切换后将连接分配给降级的主机
作者: insaf021创建于 2026年9月26日更新于 2026年9月26日
- A
Jedisis borrowed from aJedisSentinelPooland is still checked out while Sentinel fails over.initMasteronly clears idle instances, as its own comment notes. - The holder calls
close(). The instance goes back to the idle pool with its socket still connected to the demoted node. - The next
getResource()returns that instance. Writes on it getREADONLYonce the old node has been reconfigured, or, while it is partitioned and still writable, land on a node Sentinel will resync and wipe; reads return stale data.READONLYis aJedisDataException, so the connection is not marked broken and keeps being reused.
内容来源: redis/jedis