我阅读了Couchbase Rebalancing文档(http://blog.couchbase.com/rebalancing-couchbase-part-i)并写道:"A client losing its connection to the cluster will attempt to reestablish (configurable). Anytime it reconnects (first time or not) it gets the latest map that the cluster has. Ironically, a flaky network in theory might just help here to keep the map constantly updated during a rebalance, but that's for a different discussion."
我使用Spymemcached 2.7.3,我怎样才能实现这一目标 .
我举一个例子:我的Java客户端添加两个服务器(10.0.0.40和10.0.0.15,使用URL)连接到Couchbase集群 . 但实际上,当10.0.0.40下降时,持久连接没有保留 . 我必须重新启动我的客户端才能切换到10.0.0.15 . 当10.0.0.40关闭时,我的客户端如何能够重新连接到10.0.0.15而无需重新启动我的应用程序 .
更新:
我使用下面的代码连接到Couchbase集群:
ArrayList<URI> listAddr = new ArrayList<>();
listAddr.add(new URI("http://10.0.0.40:8091/pools"));
listAddr.add(new URI("http://10.0.0.15:8091/pools"));
listAddr.add(new URI("http://10.0.0.16:8091/pools"));
client = new MemcachedClient(new BinaryConnectionFactory(), listAddr, "test", "test", "");
我希望我的java客户端自动重新连接到池中的另一个服务器(40,15,16)以获得拓扑(当我的java客户端仍在运行时)如果池(40)中的第一个服务器失败 .
我可以用spymemcahce达到这个目的,或者我必须转移到Couchbase Java SDK .
1 回答
aspymemcached java客户端dos不处理特定节点的membase故障转移 .
你可以查看here .
如果将java客户端更新为couchbase java客户端,则可以通过从集群中删除故障节点来处理故障转移 . 有关更多信息,请查看here或here