简体   繁体   中英

Couchbase cluster - discover unavailable servers for Java SDK2

In Java SDK1, one can get addresses of unavailable nodes:

CouchbaseClient couchbaseClient;
//...
Collection<SocketAddress> unAvailableServers = 
    couchbaseClient.getUnavailableServers();

What is the equivalent in Java SDK2?

We intentionally didn't include this in the 2.0 SDK since the goal with the SDK was to abstract away the details of various services. Nodes have more services and are not just 'servers'.

That said, we're adding a couple of features soon under the 'health check' sdk-rfc under development which we'd love your feedback on. The idea there is that you can get information on how data is flowing at the cluster level from one API and can 'ping' to actively see what's happening from another API. You can see the development status in Couchbase's JIRA .

This is available experimentally in 2.5.0 through 2.5.3, under cluster.healthCheck() , though the method name will change to diagnostics() per the sdk-rfc. If you're just looking to monitor this client instance's understanding of the cluster, that's probably the best API for now. Code defensively so you can replace healthCheck() with diagnostics() later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM