:
Github ioredis :
Migrating-from-node_redis :
[注意 redis集群的redis版本要> 3.0才支持cluster ]
遇到的issue
Failed to refresh slots cache
https://github.com/luin/ioredis/issues/220
如果本地没有配置集群, 不要使用new ioredis.Cluster()方法去创建redisClient, 而是用new ioredis('6379', '127.0.0.1')去创建client[跟node-redis一样了]
redisCluster = [{port : 6379, host: ‘redis-server-host1’},{port : 6379, host: ‘redis-server-host2’}];if(isRedisCluster){ redisClient = new ioredis.Cluster(redisCluster); } else { redisClient = new ioredis(6379, ‘127.0.0.1’); }