redis/jedis · warning
Cannot get master address from sentinel running @
Error message
Cannot get master address from sentinel running @ {}. Reason: {}. Trying next one. What it means
While resolving the master address, each Sentinel is queried in turn. If querying one Sentinel throws a JedisException (connection failure, timeouts, or a JedisDataException — see issue #1036), the pool logs this warning with the Sentinel address and reason, then tries the next Sentinel. Only when all Sentinels fail does initSentinels throw. This is the per-Sentinel retry log for master discovery.
Solutions
- Check the 'Reason' in the log: fix connectivity to that Sentinel (host/port/firewall) or supply sentinelClientConfig with the correct password.
- Remove permanently dead Sentinels from your sentinel set to reduce discovery latency.
- Verify Sentinel auth config: if Sentinels use requirepass/ACL, set the corresponding credentials in the client's sentinel config.
- Ensure at least one healthy Sentinel remains; run `redis-cli -p 26379 ping` on each listed Sentinel.
- If JedisDataException appears, check Sentinel version compatibility and that the command isn't disabled (renamed commands).
Example fix
// before
JedisSentinelPool pool = new JedisSentinelPool(master, sentinels); // Sentinel requires auth
// after
JedisClientConfig sentinelCfg = DefaultJedisClientConfig.builder()
.password("sentinelPass").build();
JedisSentinelPool pool = new JedisSentinelPool(master, sentinels, sentinelCfg, masterCfg); Defensive patterns
Strategy: fallback
Validate before calling
for (String s : sentinels) {
try (Jedis j = new Jedis(host(s), port(s))) {
j.ping(); // preflight each sentinel's reachability/auth
}
} Try / catch
try { addr = sentinel.sentinelGetMasterAddrByName(masterName); } catch (JedisException e) { log.warn("sentinel {} failed: {}, trying next", s, e); continue; } Prevention
- Preflight all Sentinel endpoints (ping + auth) in deployment checks
- Configure Sentinel passwords in the client's sentinelClientConfig if required
- Provide 3+ Sentinels across failure domains so one bad node doesn't matter
- Remove permanently dead Sentinel entries from config
When it happens
Trigger: Connecting to or issuing sentinelGetMasterAddrByName on one Sentinel raises JedisException: Sentinel down, wrong address/port, auth required (requirepass on Sentinel), network partition, or Sentinel returns an error response.
Common situations: One Sentinel host is down or unreachable from the client; Sentinel requires a password the client config lacks; DNS points at a dead instance; firewall blocks 26379; Sentinel returning -ERR/-NOAUTH data exceptions.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- All sentinels down, cannot determine where
- Can not get master addr, master name
- Can not get master addr, master name
- Lost connection to Sentinel
- Failed to create socket.
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/294e4c73a5dd5cfe.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/JedisSentinelPool.java:274
try (Jedis jedis = new Jedis(sentinel, sentinelClientConfig)) {
List<String> masterAddr = jedis.sentinelGetMasterAddrByName(masterName);
// connected to sentinel...
sentinelAvailable = true;
if (masterAddr == null || masterAddr.size() != 2) {
LOG.warn("Can not get master addr, master name: {}. Sentinel: {}", masterName, sentinel);
continue;
}
master = toHostAndPort(masterAddr);
LOG.debug("Found Redis master at {}", master);
break;
} catch (JedisException e) {
// resolves #1036, it should handle JedisException there's another chance
// of raising JedisDataException
LOG.warn(
"Cannot get master address from sentinel running @ {}. Reason: {}. Trying next one.", sentinel, e);
}
}
if (master == null) {
if (sentinelAvailable) {
// can connect to sentinel, but master name seems to not monitored
throw new JedisException("Can connect to sentinel, but " + masterName
+ " seems to be not monitored...");
} else {
throw new JedisConnectionException("All sentinels down, cannot determine where is "
+ masterName + " master is running...");
}
}
LOG.info("Redis master running at {}, starting Sentinel listeners...", master);
for (HostAndPort sentinel : sentinels) {View on GitHub (pinned to 6dac31d4c2)