vert-x3 / vertx-redis-client

Redis client for Vert.x
http://vertx.io
Apache License 2.0
127 stars 116 forks source link

In cluster mode, local IP is cached #277

Closed chulong closed 3 years ago

chulong commented 3 years ago

Questions

In cluster mode, if domain name proxy is used, local IP is cached. If IP changes, the cluster cannot be accessed

Version

4.0.0

Context

When creating a slot, actively pull the node information of the cluster, and cache the IP information and slot of the server response. However, if the IP under the domain name changes, it will not be able to access the cluster normally

The use of domain name access is mainly to shield the IP address of the intranet and avoid exposing the IP address of the intranet

Can I cache the original address? Instead of the server return address

Extra

image

chulong commented 3 years ago

Change configuration

pmlopes commented 3 years ago

The endpoints lists are the output of the slots' response from redis itself. Redis doesn't reply with domain names but ip addresses. There's no transformation/resolution added by the client, so I'm not certain if this is a bug, but a feature so to day.

How would we know that the network changed?

pmlopes commented 3 years ago

Here's where the information about the cluster is loaded from: https://redis.io/commands/cluster-slots

A example output is:

127.0.0.1:30001> cluster slots
1) 1) (integer) 0
   2) (integer) 5460
   3) 1) "127.0.0.1"
      2) (integer) 30001
      3) "09dbe9720cda62f7865eabc5fd8857c5d2678366"
   4) 1) "127.0.0.1"
      2) (integer) 30004
      3) "821d8ca00d7ccf931ed3ffc7e3db0599d2271abf"
2) 1) (integer) 5461
   2) (integer) 10922
   3) 1) "127.0.0.1"
      2) (integer) 30002
      3) "c9d93d9f2c0c524ff34cc11838c2003d8c29e013"
   4) 1) "127.0.0.1"
      2) (integer) 30005
      3) "faadb3eb99009de4ab72ad6b6ed87634c7ee410f"
3) 1) (integer) 10923
   2) (integer) 16383
   3) 1) "127.0.0.1"
      2) (integer) 30003
      3) "044ec91f325b7595e76dbcb18cc688b6a5b434a1"
   4) 1) "127.0.0.1"
      2) (integer) 30006
      3) "58e6e48d41228013e5d9c1c37c5060693925e97e"

This means that redis itself is assuming "ipaddresses" so if the network rearranges itself the client must be recreated too.