Connect to RedisCluster with go-redis (NewClusterClient)

56 views Asked by At

I have deployed a RedisCluster ( with redis operator ) in kubernetes. Connect to all leaders and followers from redis-cli is fine. However when I tried to connect with go-redis library (), I am getting "Dial tcp: look ?: no such host" error. Although the error seems like it can resolve the redis node but I am very positive the error is not related to resolving the host 10.216.11.150 in my case but after the library connect to 10.216.11.150, it tried to resolve another node ( probably the slave node ?? ) but failed. why it tried to look up "?:" ?

    rdb := redis.NewClusterClient(&redis.ClusterOptions{
        Addrs: []string{"10.216.11.150:6379", "10.216.15.178:6379", "10.216.12.115:6379"},
        TLSConfig: &tls.Config{
            InsecureSkipVerify: true,
        },
    })

I tried to use NewUniversalClient, if I specified one node , it can connect to the cluster, once I specified more than one node in Addrs it will failed with Dial tcp: look ?: no such host" error

0

There are 0 answers