feat: enhance redis and production IA
This commit is contained in:
1 parent
644981eef4
commit
58bbc394e9
76 files changed
+1702
-721
No files matched your search
@@ -141,12 +141,13 @@ func testRedis(ctx context.Context, host string, port int, username, pass string
|
||||
redisUsername = ""
|
||||
}
|
||||
rdb := redis.NewClient(&redis.Options{
|
||||
Addr: addr,
|
||||
Username: redisUsername,
|
||||
Password: pass,
|
||||
DB: 0,
|
||||
DialTimeout: 10 * time.Second,
|
||||
ReadTimeout: 10 * time.Second,
|
||||
Addr: addr,
|
||||
Username: redisUsername,
|
||||
Password: pass,
|
||||
DB: 0,
|
||||
DialTimeout: 10 * time.Second,
|
||||
ReadTimeout: 10 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
})
|
||||
defer rdb.Close()
|
||||
|
||||
@@ -169,6 +170,14 @@ func testRedis(ctx context.Context, host string, port int, username, pass string
|
||||
}
|
||||
}
|
||||
}
|
||||
if clusterInfo, err := rdb.Do(ctx, "CLUSTER", "INFO").Text(); err == nil {
|
||||
for _, line := range strings.Split(clusterInfo, "\n") {
|
||||
line = strings.TrimRight(line, "\r")
|
||||
if strings.HasPrefix(line, "cluster_state:") {
|
||||
isCluster = strings.TrimSpace(strings.TrimPrefix(line, "cluster_state:")) == "ok"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mode := "standalone"
|
||||
if isCluster {
|
||||
|
||||
Reference in new issue
Block a user