Unable to connect ClusterClient to Azure Cache for Redis #1710
-
I'm unable to establish a connection to Azure Cache for Redis, when using the ClusterClient: //this works, but I need a ClusterClient from now on...
client := redis.NewClient(&redis.Options{
Addr: config.Queue.Redis.Addr,
Password: config.Queue.Redis.Pw,
DB: config.Queue.Redis.Db,
TLSConfig: &tls.Config{
InsecureSkipVerify: false,
},
}) //this is giving me a i/o timeout error
client := redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{config.Queue.Redis.Addr},
Password: config.Queue.Redis.Pw,
}) //this is giving me the error: x509: cannot validate certificate for xx.xxx.xx.xx because it doesn't contain any IP SANs
client := redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{config.Queue.Redis.Addr},
Password: config.Queue.Redis.Pw,
TLSConfig: &tls.Config{
InsecureSkipVerify: false,
},
}) This issue might be related to #1691 ? Any ideas? /edit: formatting |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
After further analysis I assume the standard Client correctly connects via DNS while the ClusterClient tries to connect via IP address... this causes issues because the Azure certificate is only valid for the hostname present in the Subject field of the certificate. |
Beta Was this translation helpful? Give feedback.
-
@johannesvietze it uses the address returned by https://redis.io/commands/cluster-slots . |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help. I Just checked: executing What would be your recommendation to connect redis-go with the Azure Redis Cluster under these circumstances? The only possibility I see is to overwrite the |
Beta Was this translation helpful? Give feedback.
-
No ideas here. I would expect Azure Cache team to have some solution. |
Beta Was this translation helpful? Give feedback.
-
I've opened a ticket with them and will post updates here. In the meantime, I managed to work around it by passing in my own |
Beta Was this translation helpful? Give feedback.
-
Response from azure support:
and
|
Beta Was this translation helpful? Give feedback.
-
you can try redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{"..."},
TLSConfig: &tls.Config{
ServerName: "you domain",
},
}) |
Beta Was this translation helpful? Give feedback.
-
Awesome, that's the solution. Thank you! |
Beta Was this translation helpful? Give feedback.
@johannesvietze
you can try