question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why we need to execute SENTINEL SENTINELS command?

See original GitHub issue

In 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
nameqxqcommented, May 21, 2020

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.

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);
}
0reactions
mrnikocommented, May 21, 2020

sentinels are added in registerSentinel method

Read more comments on GitHub >

github_iconTop Results From Across the Web

High availability with Redis Sentinel
Sentinel itself is designed to run in a configuration where there are multiple Sentinel processes cooperating together. The advantage of having multiple ...
Read more >
Redis Sentinel - Linux Hint
Redis Sentinel is the solution offered by Redis to ensure the high availability of master-replica instances. It acts as a configuration provider for ......
Read more >
Redis Sentinel Documentation
For a failover to be considered successful, it requires that the Sentinel was able to send the SLAVEOF NO ONE command to the...
Read more >
What Is Redis Sentinel, It's Features & How it Works | ThinkPalm
Sentinel is the source of authority for clients. The client connects to Sentinel for asking the address of the current Redis master.
Read more >
Redis Sentinel — High Availability: Everything you need to ...
If sentinel detects a failure in the MASTER node in a given cluster, Sentinel will start a failover process. As a result, Sentinel...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found