"ERR unknown command 'cluster'"
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的地址不是集群的地址,换做集群的地址即可;
posted on 2018-10-11 16:38 iokde.com 阅读(3314) 评论(0) 编辑 收藏 举报