From e483db1b97a7e1c3d5dab00ceaa017864e867d59 Mon Sep 17 00:00:00 2001 From: "meilin.huang" <954537473@qq.com> Date: Tue, 6 Jun 2023 20:51:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=93=A8=E5=85=B5=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/go.mod | 27 +++++++++++----------- server/internal/redis/application/redis.go | 15 ++++++------ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/server/go.mod b/server/go.mod index 1a5bfc2a..65b995d9 100644 --- a/server/go.mod +++ b/server/go.mod @@ -3,16 +3,16 @@ module mayfly-go go 1.20 require ( - github.com/gin-gonic/gin v1.9.0 + github.com/gin-gonic/gin v1.9.1 github.com/go-sql-driver/mysql v1.7.1 github.com/golang-jwt/jwt/v5 v5.0.0 github.com/gorilla/websocket v1.5.0 github.com/lib/pq v1.10.7 github.com/mojocn/base64Captcha v1.3.5 // 验证码 github.com/pkg/sftp v1.13.5 - github.com/redis/go-redis/v9 v9.0.4 + github.com/redis/go-redis/v9 v9.0.5 github.com/robfig/cron/v3 v3.0.1 // 定时任务 - github.com/sirupsen/logrus v1.9.2 + github.com/sirupsen/logrus v1.9.3 github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 go.mongodb.org/mongo-driver v1.11.4 // mongo golang.org/x/crypto v0.9.0 // ssh @@ -23,41 +23,42 @@ require ( ) require ( - github.com/bytedance/sonic v1.8.0 // indirect + github.com/bytedance/sonic v1.9.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.11.2 // indirect - github.com/goccy/go-json v0.10.0 // indirect + github.com/go-playground/validator/v10 v10.14.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/golang/snappy v0.0.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.13.6 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/kr/fs v0.1.0 // indirect - github.com/leodido/go-urn v1.2.1 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/leodido/go-urn v1.2.4 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.9 // indirect + github.com/ugorji/go/codec v1.2.11 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.1 // indirect github.com/xdg-go/stringprep v1.0.3 // indirect github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect - golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect + golang.org/x/arch v0.3.0 // indirect golang.org/x/image v0.0.0-20220302094943-723b81ca9867 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/server/internal/redis/application/redis.go b/server/internal/redis/application/redis.go index cecc61dc..eb15636d 100644 --- a/server/internal/redis/application/redis.go +++ b/server/internal/redis/application/redis.go @@ -219,13 +219,14 @@ func getRedisSentinelCient(re *entity.Redis, db int) *RedisInstance { // sentinel模式host为 masterName=host:port,host:port masterNameAndHosts := strings.Split(re.Host, "=") sentinelOptions := &redis.FailoverOptions{ - MasterName: masterNameAndHosts[0], - SentinelAddrs: strings.Split(masterNameAndHosts[1], ","), - Password: re.Password, // no password set - DB: db, // use default DB - DialTimeout: 8 * time.Second, - ReadTimeout: -1, // Disable timeouts, because SSH does not support deadlines. - WriteTimeout: -1, + MasterName: masterNameAndHosts[0], + SentinelAddrs: strings.Split(masterNameAndHosts[1], ","), + Password: re.Password, // no password set + SentinelPassword: re.Password, // 哨兵节点密码需与redis节点密码一致 + DB: db, // use default DB + DialTimeout: 8 * time.Second, + ReadTimeout: -1, // Disable timeouts, because SSH does not support deadlines. + WriteTimeout: -1, } if re.SshTunnelMachineId > 0 { sentinelOptions.Dialer = getRedisDialer(re.SshTunnelMachineId)