如何使用memcache复制数据
我正在尝试寻找有关跨内存缓存服务器数据复制最佳实践的良好资源。我想要完成的是,如果池中的一台服务器出现故障,下一个服务器已经具有信息集。
我找到了“repcached”,但是由于我运行的是WIN32测试环境,所以我一直无法安装它。
那么在服务器之间复制数据的替代方案是什么?
谢谢,
I am trying to find good resources on best practices to data replication across memcache servers. What I want to accomplish is that if one of my servers in my pool goes down, the next server in line already has the info set.
I have found "repcached" but since I run a WIN32 test environment, I have been unable to install it.
So what's our alternatives on how to replicate data between servers?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己从来没有为此烦恼(memcache 毕竟只是一个缓存,即使每个实例都是每个其他实例的精确副本,您仍然不能保证添加一个值后将始终存在:例如,它可能会由于 LRU 策略而被驱逐)。
但是,如果我要将此作为一项功能来实现,我会将其放在客户端中,而不是作为服务器的补丁。
也就是说,不是将密钥散列到单个服务器,而是将其散列到 2 或 3 个服务器并将值存储在所有服务器上。然后,当再次获取该值时,尝试从第一个获取它,如果不存在,请尝试第二个,依此类推。
这样做的另一个好处是不复制每个值:您只能复制那些您选择的值。
I've never bothered with this myself (memcache is just meant to be a cache after all, even if each instance was an exact copy of every other instance, you still can't guarantee that a value will always exist once you add it: it might be evicted due to the LRU policy, for example).
However, if I were to implement this as a feature, I would put it in the client and not as a patch to the server.
That is, instead of hashing a key to a single server, hash it to 2 or 3 servers and store the value on all of them. Then, when getting the value back again, try to get it from the first, if it's not there, try the second one and so on.
This has the added benefit of not replicating every value: you can replicate only those that you choose to.