From f8b2dc8c9fd77a3cfb80664cd45cf91f25f9ea15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E8=B1=86=E8=8A=BD?= Date: Thu, 9 Mar 2023 21:37:34 +0800 Subject: [PATCH] reids cluster bug (#2986) Co-authored-by: shaocongcong --- core/stores/redis/redisblockingnode.go | 3 ++- core/stores/redis/redisclustermanager.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/stores/redis/redisblockingnode.go b/core/stores/redis/redisblockingnode.go index 696b88605..bdb478714 100644 --- a/core/stores/redis/redisblockingnode.go +++ b/core/stores/redis/redisblockingnode.go @@ -2,6 +2,7 @@ package redis import ( "fmt" + "strings" red "github.com/go-redis/redis/v8" "github.com/zeromicro/go-zero/core/logx" @@ -31,7 +32,7 @@ func CreateBlockingNode(r *Redis) (ClosableNode, error) { return &clientBridge{client}, nil case ClusterType: client := red.NewClusterClient(&red.ClusterOptions{ - Addrs: []string{r.Addr}, + Addrs: strings.Split(r.Addr, ","), Password: r.Pass, MaxRetries: maxRetries, PoolSize: 1, diff --git a/core/stores/redis/redisclustermanager.go b/core/stores/redis/redisclustermanager.go index de8b12032..1f1e1b19c 100644 --- a/core/stores/redis/redisclustermanager.go +++ b/core/stores/redis/redisclustermanager.go @@ -3,6 +3,7 @@ package redis import ( "crypto/tls" "io" + "strings" red "github.com/go-redis/redis/v8" "github.com/zeromicro/go-zero/core/syncx" @@ -19,7 +20,7 @@ func getCluster(r *Redis) (*red.ClusterClient, error) { } } store := red.NewClusterClient(&red.ClusterOptions{ - Addrs: []string{r.Addr}, + Addrs: strings.Split(r.Addr, ","), Password: r.Pass, MaxRetries: maxRetries, MinIdleConns: idleConns,