Why we need to execute SENTINEL SENTINELS command?
See original GitHub issueIn this case, I configured the all intranet domain sentinel node list info。 like this
spring:
redis:
sentinel:
nodes:
- inner.domain1:port
- inner.domain2:port
- inner.domain3:port
master: master_name
But I can’t start redisson successfully, it throws a RedisConnectionException with ‘SENTINEL SENTINELS command returns less than 2 nodes…’ message
Because the first configured sentinel node will be used to execute the SENTINEL SENTINELS MASTER_NAME command when initializing the SentinelConnectionManager, and then try to connect to the returned node list.
But the IP:PORT information of the sentinel node list we return is inaccessible by the current machine(By default, we only allow access via intranet domain), So all these sentinel node failed to register, except the current node(It uses intranet domain access)。
List<Map<String, String>> sentinelSentinels = connection.sync(StringCodec.INSTANCE, RedisCommands.SENTINEL_SENTINELS, cfg.getMasterName());
List<RFuture<Void>> connectionFutures = new ArrayList<>(sentinelSentinels.size());
for (Map<String, String> map : sentinelSentinels) {
if (map.isEmpty()) {
continue;
}
String ip = map.get("ip");
String port = map.get("port");
RedisURI sentinelAddr = toURI(ip, port);
// I cannot register this node
// because I cannot access it use this ip and port
RFuture<Void> future = registerSentinel(sentinelAddr, this.config);
connectionFutures.add(future);
}
RedisURI currentAddr = toURI(client.getAddr().getAddress().getHostAddress(), "" + client.getAddr().getPort());
RFuture<Void> f = registerSentinel(currentAddr, this.config);
Can we add an option to directly use the configured node list without having to execute the SENTINEL SENTINELS MASTER_NAME command to get the list?
Now, I called dba to restart the sentinel node list, and replaced the sentinel list information, so that the information returned by sentinel list api can be accessed by my current machine, temporarily solved this problem.
However, if my new machine in another network cluster also needs to use redisson to connect to this sentinel cluster, things will become more troublesome.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
But my sentinels can only be accessed through the intranet domain(I will configure all the nodes),and the sentinel list api returned ip port is inaccessible.
sentinels are added in registerSentinel method