Open jppade opened 2 weeks ago
I don't quite understand what it means. The go-redis connection to redis-cluster is different from a standalone Redis connection. It will use the node address returned by redis-cluster (CLUSTER NODES). If it's a local address, it won't be accessible from outside.
What do we want to do? Connect to a Redis cluster (consisting of 3 masters and 3 slaves) running in Kubernetes using
kubectl port-forward
tolocalhost:6379
. The client looks as follows:Connection from localhost works fine with
redis-cli -c -p 6379 -a redis_password
using the port-forward.Expected Behavior
Connect to remote redis cluster.
Current Behavior
The following error:
dial tcp remote_ip:6379: connect: no route to host
Whereremote_ip
is the ip address of a master node in the cluster, i.e. the first master obtained bycluster slots
. It looks as if the cluster client library rerouteslocalhost:6379
to a cluster node and tries to reconnect, which obviously fails.Possible Solution
Not a solution, but we tried adding
to
redis.Options
in the cluster client such as proposed in https://github.com/redis/go-redis/issues/1698. This did not work though.