preadis-从连接池删除服务器
说,我在Predis Connection池中有n个服务器。我发现,当服务器下降时,Predis不起作用(即新的Predis/Client(S1,S2,...),如果Server Si降低了任何服务器,则不会成功返回)。首先,需要手动删除该失败的服务器的输入,并且只有在此Predis才能恢复其工作之后。 由于Predis声称使用一致的哈希,因此Predis是否会自动检测到哪个服务器未响应的情况(失败),并将存储在失败的服务器上的键分配给其他工作服务器的键?
Say, I am having N servers in the predis connection pool. I found that when one of the server does down, predis does not work(i.e. new predis/client(s1,s2,...) does not return successfully if any of the server Si is down). First, the entry of that failed server needs to be removed manually, and only after this predis resumes its work.
Since, predis claims to be using consistent hashing, shouldn't this be the case that predis automatically detects which of the server is not responding ( & has failed), and distribute the keys stored on the failed server to the other working servers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Predis确实使用一致的散列,但是要确保池中的所有服务器都启动并做出响应。监视服务器的可用性并非本质上暗示着一致的哈希。
您可以在尝试连接之前检查每个服务器,并根据您的支票修改连接池。您可以在其他地方存储池的可用服务器列表,并会不断观看和修改可用服务器列表。您可以假设它们总是全部升起,并且只检查需要在失败时删除哪些,或者可以使用上述任何组合。最重要的是,目前,Predis还没有为您做。
Predis does use consistent hashing, but it is left to you to ensure that all servers in the pool are up and responding. Monitoring server availability is not intrinsically implied with consistent hashing.
You can check each server before you attempt to connect, and modify your connection pool based on your checks. You can store the available server list for the pool elsewhere and have some other process constantly watching and modifying the available server list. You could just assume they are always all up, and only check which ones need to be removed on a failure, or you can use any combination of the above. The bottom line is that predis does not, at the moment, do it for you.