go-redis
go-redis copied to clipboard
go redis v8 error: i/o timeout
connect redis via go-redis package v8, but get error: i/o timeout.
connection code:
rdb := redis.NewClient(&redis.Options{ Addr: config.GConfig.Dependency.Redis.Address, Password: config.GConfig.Dependency.Redis.Password, DB: 0, })
the Address is Azure redis cache service. Address and Password are correct.
First, you can test the connection with the redis address using nc/telnet/curl.
it is some network problem, having nothing to do with go-redis at all. Is the redis port enabled in the firewall rules? or the network between you and azure is smooth or not blocked by the firewall?
same issue i have.
I can connect to redislab using RedisInsight client with same redis address, password, port, username. But always show i/o timeout err in my golang code.
Hei @levi-h-20230331 I found the solution already.
It's because you using the v9 version of go redis.
use import "github.com/go-redis/redis/v8" because the redis lab version is 7.x.x
Github: https://github.com/redis/go-redis/tree/v8
@tanzilgr2288 what redis lab version is v9 supposed to support? this isn't clear in the documentation from what I could see.