Unable to connect to [172.25.0.4/<unresolved>:6379] #3047
-
I am spinning up a Redis cluster locally using this docker-compose file and running the following command:
and trying to switch over to using the cluster-aware client using the following code since we were seeing some
The last line from the above is producing the following error:
Any ideas what might be missing here?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
On Mac docker runs in VM and is a bit tricky to get it right. One way to overcome this is to set "--cluster-announce-ip 127.0.0.1" and "--cluster-announce-port " and make sure each node is mapped on different port for more details you can check
|
Beta Was this translation helpful? Give feedback.
-
@ggivo Thank you for the quick turnaround! This is what my compose file looks like after adding the two options you suggested, as well as making sure that there are no port conflicts. Now, when I run the same
the command hangs on "Waiting for the cluster to join." I tried this same workflow to spin up a Redis instance in Ubuntu in an EC2 instance to test, and in that case the cluster is automatically created after running
I wasn't able to test connecting to the Ubuntu Redis instance through my app using the cluster aware client though. Any other options/configurations I could be missing in the case of spinning the cluster up locally on my M1 with those options you suggested? |
Beta Was this translation helpful? Give feedback.
I had a similar issue in my env but tottaly forgot about it.
If I remember correctly, it was related to a bug in redis-cli when using 127.0.0.1.
So, instead of loopback address 127.0.0.1, I changed the nodes to use the MAC host's actual IP (192....).
I also :
started Redis nodes on the same port exposed in docker container
exposed also the cluster management port
I ended up with something like
https://gist.github.com/ggivo/ce80b12ab75b40668010eb335103dacc
redis-cli --cluster create 192.168.86.43:6380 192.168.86.43:6381 192.168.86.43:6382 --cluster-replicas 0 --cluster-yes
By the way, if you need a way to start test or dev env on MAC, we have prepared a docker image that runs all Redis nod…