7

Redis cluster requires that all nodes can see each other to chatter; to accommodate some trivial situations (eg. docker with all nodes publicly exposed) some additional config options are available:

cluster-announce-ip 10.1.1.5
cluster-announce-port 6379
cluster-announce-bus-port 6380

(see http://download.redis.io/redis-stable/redis.conf for the only available documentation on these options)

Notice these values are hard coded into the config file. This is extremely inconvenient.

Is it possible to somehow configure redis to use a hostname instead of an IP for the endpoint? Is there any workaround for this?

As a tangible example of why this is required, consider attempting to configure a test redis cluster in a docker image with multiple redis instances on the single container via a Dockerfile:

  • If cluster-announce-ip is set, all nodes attempt to chatter via cluster-announce-ip.

  • If cluster-announce-ip is an external IP, since the docker image is not being run with -p during docker build..., the external IP is not available and the cluster cannot be configured.

  • If cluster-announce-ip is not set, the cluster can be configured, but since the ip is docker-internal, it cannot be seen externally once the cluster is running (external clients will complain when they get a MOVED 10.0.0.x:2321 which is not visible to the external client).

  • You must use docker build ... and then manually provision the nodes using docker commit ... to snapshot the result.\

  • When you run the container on a different physical host, you have to update the image manually to change the announce ip (When using DHCP this become even more problematic).

I appreciate docker swarm is one possible solution to this issue in general, but for testing purposes (eg. local development) it's not a relevant solution.

Simply using hostnames instead of ips would allow developers to just use host file entries to connect instead of having to manually update the docker image for every developer (obviously each development machine has its own external ip).

1 Answer 1

4

Nope, it ain't supported yet - there's an open issue on the subject though: https://github.com/antirez/redis/issues/2186

2
  • 1
    This issue is from 2014... :| Is there really no work around for this?
    – Doug
    Jan 31, 2018 at 5:08
  • Checking the issue again shows that it's been addressed in Redis 7.
    – jocull
    Oct 19, 2022 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.