redis/jedis · warning

Could not get master address from

Error message

Could not get master address from {}.

What it means

In SentineledConnectionProvider.initSentinels(), any JedisException thrown while querying a Sentinel (connecting to it or calling sentinelGetMasterAddrByName) is caught and logged as this warning, and the provider tries the next Sentinel. This exists because the query itself can raise JedisDataException or connection-level JedisException (issue #1036). If every Sentinel fails and none reported a master, initialization then fails with a JedisException ('Could not connect to sentinel' or, when Sentinels were reachable but no master found, the master-not-monitored message).

Solutions

  1. Verify each Sentinel is reachable: telnet/redis-cli -p <sentinel-port> PING on every configured Sentinel address.
  2. Correct the Sentinel host:port list in the client configuration.
  3. Run 'SENTINEL get-master-addr-by-name <masterName>' manually; if it errors, check the Sentinel logs for data/authorization errors.
  4. Run at least 3 Sentinels with proper quorum so a single down node does not block master discovery.
  5. Retry client initialization once the Sentinels are back (or add application-level retry around client construction).

Example fix

// before
Set<String> sentinels = new HashSet<>(Arrays.asList("sentinel1:26379")); // single, down
// after
Set<String> sentinels = new HashSet<>(Arrays.asList(
  "sentinel1:26379", "sentinel2:26379", "sentinel3:26379")); // redundancy + quorum
Defensive patterns

Strategy: retry

Validate before calling

for (String s : sentinels) {
  String[] hp = s.split(":");
  try (Jedis j = new Jedis(hp[0], Integer.parseInt(hp[1]))) {
    if ("PONG".equals(j.ping())) continue; // sentinel reachable
  }
  throw new IllegalStateException("Sentinel unreachable: " + s);
}

Try / catch

int attempts = 0;
while (attempts++ < 3) {
  try {
    pool = new JedisSentinelPool(masterName, sentinels, config);
    break;
  } catch (JedisException e) {
    if (attempts == 3) throw new IllegalStateException("Could not resolve master from any Sentinel after retries", e);
    Thread.sleep(1000L * attempts); // Sentinels may be transiently down
  }
}

Prevention

When it happens

Trigger: sentinelGetMasterAddrByName or the Sentinel connection itself throws JedisException for a given Sentinel node — e.g. connection refused/timeout to the Sentinel, Sentinel returning a data error (JedisDataException), or Sentinel resetting the connection mid-query.

Common situations: Sentinel host/port misconfigured (wrong port, firewall, DNS); Sentinel process down while others also down; Sentinel quota/auth issues returning data errors; all Sentinels unreachable so the client cannot resolve the master at startup.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08). Data as JSON: /api/errors/32333451eaf97bbe. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/redis/clients/jedis/providers/SentineledConnectionProvider.java:276

        sentinelClientConfig)) {

        List<String> masterAddr = jedis.sentinelGetMasterAddrByName(masterName);

        // connected to sentinel...
        sentinelAvailable = true;

        if (masterAddr == null || masterAddr.size() != 2) {
          LOG.warn("Sentinel {} is not monitoring master {}.", sentinel, masterName);
          continue;
        }

        master = toHostAndPort(masterAddr);
        LOG.debug("Redis master reported at {}.", master);
        break;
      } catch (JedisException e) {
        // resolves #1036, it should handle JedisException there's another chance
        // of raising JedisDataException
        LOG.warn("Could not get master address from {}.", 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 " + masterName + " is running.");
      }
    }

    LOG.info("Redis master running at {}. Starting sentinel listeners...", master);

    for (HostAndPort sentinel : sentinels) {

View on GitHub (pinned to 6dac31d4c2)