Fixed - the first online Sentinel hostname in Redisson config isn't resolved at startup. #2813

pull/2819/head
Nikita Koksharov 5 years ago
parent e8ced7c679
commit 91051af3de

@ -87,13 +87,18 @@ public class SentinelConnectionManager extends MasterSlaveConnectionManager {
checkAuth(cfg);
Throwable lastException = null;
for (String address : cfg.getSentinelAddresses()) {
RedisURI addr = new RedisURI(address);
addr = applyNatMap(addr);
if (NetUtil.createByteArrayFromIpAddressString(addr.getHost()) == null && !addr.getHost().equals("localhost")) {
sentinelHosts.add(addr);
}
}
Throwable lastException = null;
for (String address : cfg.getSentinelAddresses()) {
RedisURI addr = new RedisURI(address);
addr = applyNatMap(addr);
RedisClient client = createClient(NodeType.SENTINEL, addr, this.config.getConnectTimeout(), this.config.getTimeout(), null);
try {
@ -112,6 +117,9 @@ public class SentinelConnectionManager extends MasterSlaveConnectionManager {
throw new RedisConnectionException("Master node is undefined! SENTINEL GET-MASTER-ADDR-BY-NAME command returns empty result!");
}
RFuture<Void> sentinelFuture = registerSentinel(addr, this.config, null);
sentinelFuture.sync();
RedisURI masterHost = toURI(master.getHostString(), String.valueOf(master.getPort()));
this.config.setMasterAddress(masterHost.toString());
currentMaster.set(masterHost);

Loading…
Cancel
Save