go-redis
go-redis copied to clipboard
使用 rdb.Get() 报错 panic: read tcp 192.168.31.70:50126->192.168.31.22:6379: wsarecv: An existing connection was forcibly closed by the remote host.
Issue tracker is used for reporting bugs and discussing new features. Please use stackoverflow for supporting issues.
使用 rdb.Get() 报错 panic: read tcp 192.168.31.70:50126->192.168.31.22:6379: wsarecv: An existing connection was forcibly closed by the remote host.
使用 rdb.Get() 报错 panic: read tcp 192.168.31.70:50126->192.168.31.22:6379: wsarecv: An existing connection was forcibly closed by the remote host. 代码如下, DOMAIN_INFOS 中为字符串 约34000个字符 func opRedis(x [][]string) { var ctx = context.Background() rdb := redis.NewClient(&redis.Options{ Addr: "192.168.31.22:6379", Password: "qwe@123456", DB: 0, // use default DB })
Scan_Status, err := rdb.Get(ctx, "ScanStatus").Result()
if err != nil {
panic(err)
}
fmt.Println("ScanStatus: ", Scan_Status)
DOMAIN_INFOS, err := rdb.Get(ctx, "DOMAIN_INFOS").Result()
if err != nil {
panic(err)
}
fmt.Println("DOMAIN_INFOS: ", DOMAIN_INFOS)
}
程序可以打印 ScanStatus ScanStatus: 1 panic: read tcp 192.168.31.70:50126->92.168.31.22:6379: wsarecv: An existing connection was forcibly closed by the remote host.
goroutine 1 [running]: main.opRedis({0xc0000c7f28, 0x3, 0x6?}) C:/GoProject/src/golearn/opredis/main.go:36 +0x547
这是什么原因造成的呢?或者我该如何取出这个值? 希望得到您的解答, 谢谢!!!
Steps to Reproduce
Context (Environment)
Detailed Description
Possible Implementation
是否多次尝试连接都是这个error,如果是的话,检查一下redis.conf配置文件中是否开启了IP绑定