@yibo
2016-04-22T03:35:25.000000Z
字数 1353
阅读 979
Jiemo
Redis
Codis
集群
Codis由豌豆荚于2014年11月开源,基于Go和C开发。
https://github.com/CodisLabs/codis
目前咱们 Redis 集群使用的应该算是客户端分片,主要问题是升级麻烦,Redis 实例的增减,都得手工调整分片程序。
代理分片的主要代表就是 Twemproxy (Twitter 开源)和 Codis。
Codis 与 Twemproxy 和 Redis Cluster 三者的比较(摘自 Codis Github):
Codis | Twemproxy | Redis Cluster | |
---|---|---|---|
resharding without restarting cluster | Yes | No | Yes |
pipeline | Yes | Yes | No |
hash tags for multi-key operations | Yes | Yes | Yes |
multi-key operations while resharding | Yes | - | No |
Redis clients supporting | Any clients | Any clients | Clients have to support cluster protocol |
Benchmark:https://github.com/CodisLabs/codis/blob/master/doc/benchmark.md
官网文档写的还挺详细的:
https://github.com/CodisLabs/codis/blob/master/doc/tutorial_zh.md
Jodis
类以供使用(仅仅做了测试,还没在代码中使用),
Jodis.INSTANCE.getJedis().get("foo"); //bar
另外 jiemo-component 中 io.codis.jodis.RoundRobinJedisPool
类是为了覆盖原有依赖中对应的类的(原有的要依赖 Jedis 的 2.8.0 版本),勿删。