redis-cluster研究和使用 : http://hot66hot.iteye.com/blog/2050676
Github ioredis : https://github.com/luin/ioredis
Migrating-from-node_redis : https://github.com/luin/ioredis/wiki/Migrating-from-node_redis
[注意 redis集群的redis版本要> 3.0才支持cluster ] http://redis.io/download
遇到的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’); }
李晓东 现任职于北京行云智网络科技有限公司,Node.js工程师