go-redis icon indicating copy to clipboard operation
go-redis copied to clipboard

go redis v8 error: i/o timeout

Open jiu-chen opened this issue 4 years ago • 2 comments

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.

jiu-chen avatar Jan 27 '21 06:01 jiu-chen

First, you can test the connection with the redis address using nc/telnet/curl.

x1nchen avatar Apr 14 '21 16:04 x1nchen

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?

wangfengfly avatar Sep 03 '21 08:09 wangfengfly

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.

levi-h-20230331 avatar Aug 06 '23 08:08 levi-h-20230331

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 avatar Aug 06 '23 16:08 tanzilgr2288

@tanzilgr2288 what redis lab version is v9 supposed to support? this isn't clear in the documentation from what I could see.

osteensco avatar Aug 07 '23 02:08 osteensco