2

I have created a redis cluster that on it's own is working but I can't connect my client to it.

I am using redisson to connect to it, with the following code

Config config = new Config();
config.setUseLinuxNativeEpoll(false);
config.useClusterServers().addNodeAddress(redisURL.split(","));
RedissonClient redisson = Redisson.create(config);

Where redisURL is a csv on the format: redis://<external-ip>:7000,redis://<external-ip>:7001 but with all 6 nodes in the cluster.

The interesting part is that the cluster is connected to itself using their local adresses(they are on the same subnet) but they cannot find eachother with their respective external ip.

This in turn creates a problem when redisson tries to fetch cluster configurations.

15:53:51,035 INFO  [org.redisson.cluster.ClusterConnectionManager] (ServerService Thread Pool -- 31) Redis cluster nodes configuration got from /<external-ip>:7001:
6df5ebaf45cbbd36213f482a26e99e14e3e86fa5 <internal-ip>:7000@17000 master - 0 1516632829096 2 connected 5461-10922
7724d373393edf7f38ae6253ce248f75f398a1c6 <internal-ip>:7001@17001 slave e5dc7e472410e575a0dc672ead79b54828897ce3 0 1516632830099 6 connected
649582188b2c22b472388c27550467fe97522e3f <internal-ip>:7001@17001 myself,master - 0 1516632828000 1 connected 0-5460
792d30f7c2eedd80d99af5cc49d7797d6b29bdf3 <internal-ip>:7002@17002 slave 6df5ebaf45cbbd36213f482a26e99e14e3e86fa5 0 1516632828093 4 connected
349d846c493fcc709d31c657321a48e01ae0b34e <internal-ip>:7001@17001 slave 649582188b2c22b472388c27550467fe97522e3f 0 1516632827000 5 connected
e5dc7e472410e575a0dc672ead79b54828897ce3 <internal-ip>:7000@17000 master - 0 1516632828000 3 connected 10923-16383

15:54:01,113 ERROR [org.redisson.cluster.ClusterConnectionManager] (redisson-netty-1-5) Can't connect to master: redis://<internal-ip>:7000 with slot ranges: [[10923-16383]]
15:54:01,121 ERROR [org.redisson.cluster.ClusterConnectionManager] (redisson-netty-1-6) Can't connect to master: redis://<internal-ip>:7001 with slot ranges: [[0-5460]]
15:54:01,127 ERROR [org.redisson.cluster.ClusterConnectionManager] (redisson-netty-1-1) Can't connect to master: redis://<internal-ip>:7000 with slot ranges: [[5461-10922]]

So is there a way to tell redisson to map the internal IP to a preconfigured external IP? or something else that would solve this problem? preferably without changing the network configuration.

Shubham
  • 2,847
  • 4
  • 24
  • 37
munHunger
  • 2,572
  • 5
  • 34
  • 63

1 Answers1

0

I encountered the same problem when building redis cluster. I used redisson to connect the redis cluster, redis client programs such as (redis desktop manager) to connect to my redis cluster, all can connect normally, but when the redisson program was initialized, it prompted connection timed out: 172.18.202.111/172.18.202.111:7000.

After consulting the documents, I found that my redis cluster communication needs other ports 17000 17001 17002, (+10000)

You may need to open the relevant port access restrictions. If you use the node Ip returned by executing CLUSTER nodes command to contain intranet Ip, you need to modify the nodes.conf file automatically generated by redis cluster to change intranet IP to extranet Ip.

For example: 053420032000043aa9983d5b30e09c83258b3186 intranet IP address: 6379 myself, master - 001 connected 0 - 5460 053420032000043aa9983d5b30e09258b3186 your public network IP address: 6379 myself, master - 001 connected 0 - 5460

Because the redis configuration file has already stated that cluster is an automatic configuration file, which usually does not need to be modified by itself. But sometimes, for example, in my case, I only have an Intranet Card, and the IP address of public network is estimated to be converted to private address by NAT.

sky
  • 1