{"id":"3b7723d9ac4e785b","repo":"go-redis/redis","slug":"redis-all-sentinels-specified-in-configuration-ar","errorCode":null,"errorMessage":"redis: all sentinels specified in configuration are unreachable","messagePattern":"redis: all sentinels specified in configuration are unreachable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sentinel.go","lineNumber":1132,"sourceCode":"\t\t\t\tc.opt.MasterName, err)\n\t\t\tcontinue\n\t\t}\n\t\tsentinelReachable = true\n\t\taddrs := parseReplicaAddrs(replicas, useDisconnected)\n\t\tif len(addrs) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\t// Push working sentinel to the top.\n\t\tc.sentinelAddrs[0], c.sentinelAddrs[i] = c.sentinelAddrs[i], c.sentinelAddrs[0]\n\t\tc.setSentinel(ctx, sentinel)\n\n\t\treturn addrs, nil\n\t}\n\n\tif sentinelReachable {\n\t\treturn nil, nil\n\t}\n\treturn nil, errors.New(\"redis: all sentinels specified in configuration are unreachable\")\n}\n\nfunc (c *sentinelFailover) getMasterAddr(ctx context.Context, sentinel *SentinelClient) (string, error) {\n\taddr, err := sentinel.GetMasterAddrByName(ctx, c.opt.MasterName).Result()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn net.JoinHostPort(addr[0], addr[1]), nil\n}\n\nfunc (c *sentinelFailover) getReplicaAddrs(ctx context.Context, sentinel *SentinelClient) ([]string, error) {\n\taddrs, err := sentinel.Replicas(ctx, c.opt.MasterName).Result()\n\tif err != nil {\n\t\tinternal.Logger.Printf(ctx, \"sentinel: Replicas name=%q failed: %s\",\n\t\t\tc.opt.MasterName, err)\n\t\treturn nil, err\n\t}\n\treturn parseReplicaAddrs(addrs, false), nil","sourceCodeStart":1114,"sourceCodeEnd":1150,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/sentinel.go#L1114-L1150","documentation":"Returned by the sentinel failover client when every Sentinel in SentinelAddrs was contacted for replica discovery and none responded successfully (sentinelReachable stayed false). Unlike a partial failure (which returns nil/empty addrs to retry master), this means no Sentinel could be reached at all during a replica lookup cycle.","triggerScenarios":"All Sentinel processes are down or unreachable (network, host failure). Wrong Sentinel ports/addresses in config. Firewall or auth blocking all Sentinel connections. A transient total network partition during a replica query.","commonSituations":"Sentinel host outage or maintenance. Network partition isolating the app from all Sentinels. Misconfigured Sentinel ports after an infra migration. TLS or auth mismatch on every Sentinel.","solutions":["Verify network reachability and correct ports for every Sentinel address (redis-cli -p <sentinelPort> ping).","Check that Sentinel processes are running on the configured hosts.","Confirm auth/TLS settings in SentinelOptions match each Sentinel's configuration.","Add more Sentinel addresses for redundancy and tune the failover client's retry/backoff so it survives transient partitions."],"exampleFix":"// before\nclient := redis.NewFailoverClient(&redis.FailoverOptions{\n    MasterName:    \"mymaster\",\n    SentinelAddrs: []string{\"sentinel-1:26379\"}, // down/unreachable\n})\n\n// after — multiple reachable sentinels + retries\nclient := redis.NewFailoverClient(&redis.FailoverOptions{\n    MasterName:    \"mymaster\",\n    SentinelAddrs: []string{\"sentinel-1:26379\", \"sentinel-2:26379\", \"sentinel-3:26379\"},\n    MaxRetries:    5,\n})","handlingStrategy":"retry","validationCode":"func pingSentinels(addrs []string) error {\n    var lastErr error\n    for _, a := range addrs {\n        c := redis.NewClient(&redis.Options{Addr: a})\n        if err := c.Ping(context.Background()).Err(); err != nil {\n            lastErr = err\n            continue\n        }\n        _ = c.Close()\n        return nil\n    }\n    return fmt.Errorf(\"no sentinel reachable: %w\", lastErr)\n}","typeGuard":null,"tryCatchPattern":"addr, err := failoverClient.MasterAddr(ctx)\nif err != nil && err.Error() == \"redis: all sentinels specified in configuration are unreachable\" {\n    // total sentinel outage; back off and retry, or fail over to a static master\n}","preventionTips":["Configure 3+ Sentinel addresses on independent hosts.","Health-check Sentinels at startup and on a schedule.","Verify Sentinel ports/auth match the config.","Set retry/backoff so transient partitions don't hard-fail the app."],"tags":["sentinel","failover","network","outage","availability"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}