如何使用 Redis 作为分布式键值存储
我的要求 -
- 位于不同机器上执行设置/获取操作的分布式应用程序
- 能够添加服务器并重新平衡某些数据区域。 [又名 - 一致性哈希]
问题 - 浏览一下吹嘘实现一致性哈希的 REDIS 客户端 - JEDIS 等。他们似乎将 shardinfo 的密钥存储在内存中,因此不确定 [1] 将如何工作。
My requirements -
- Distributed applications sitting on different machines doing set/get operation
- Ability to add servers and rebalance certain regions of data. [ A.K.A. - consistent hashing ]
Issues -
Looking through REDIS client which boast of implementing consistent hashing - JEDIS,etc. They seem to be storing the key to shardinfo in memory thereby not sure ahow [1] will work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Redis 作者的这篇博客文章可能会有所帮助。正如那里所述,目前您可以在客户端上进行分片,但这会遇到可维护性问题。
This blog post from the author of redis might be helpful. As stated there, for the moment you can shard on the client, which suffers from maintainability problems.
Redis 还没有真正的分布式解决方案,Redis Cluster 尚未出现。您可以进行主从复制来提供更高的性能和可靠性。但是像“如果旧主服务器离线则自动选择新主服务器”之类的所有事情都应该手动完成。
Redis does not have really distributed solution, Redis Cluster is on its way yet. You can do master-slave replication to afford higher performance and reliability. But all stuff like "automatically select new master if old master is offline" should be done manually.
另一个例子说明了 CRAIGLIST 的 REDIS 分片,其中他们有一致哈希环上的虚拟节点名称,无需重新分片/洗牌即可将容量加倍。
Another example illustrating REDIS sharding at CRAIGLIST wherein they have virtual node names on the consistent hash ring and can double the capacity without re-sharding/shuffling.
Redis 集群实施正在进行中,并且正在进行 beta 测试。不过目前还不稳定,不过你可以尝试一下。
http://redis.io/topics/cluster-spec
还有另一个选项 Sharded Jedis Pool 。
https://github.com/xetorthio/jedis/wiki/AdvancedUsage
Redis Cluster implementation is in progress and also under beta Testing. However it's not stable right now but you can try it.
http://redis.io/topics/cluster-spec
There is another option also Sharded Jedis Pool.
https://github.com/xetorthio/jedis/wiki/AdvancedUsage