golang 連接配接redis 叢集提示 "ERR unknown command 'cluster'"
redisdb = redis.NewClusterClient(&redis.ClusterOptions{
Addrs: redisNodes,
MaxRetries: redisConf.RetryTimes,
DialTimeout: 10 * time.Duration(redisConf.RedisTimeout) * time.Millisecond,
ReadTimeout: 500 * time.Millisecond,
WriteTimeout: 10 * time.Millisecond,
})
if redisdb == nil {
return errors.New("client init fail is nil ")
}
pong, err := redisdb.Ping().Result()
fmt.Println("ping test :", pong ," err :", err)
原因:redis的位址不是叢集的位址,換做叢集的位址即可;
轉載于:https://www.cnblogs.com/lavin/p/9773341.html