1

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

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

What is the equivalent in Java SDK2?

Ori Dar
  • 18,687
  • 5
  • 58
  • 72
  • Might be good to describe your use case a bit more. Would let me augment my answer on how to do whatever it is you're trying to do. – Matt Ingenthron Dec 28 '17 at 00:46
  • @MattIngenthron my use case is straightforward: I'm in the middle of upgrading from sdk1 -> sdk2 (2.4.8). The above mentioned API call is simply used for reporting, and I'd wondered if there's a replacement. Can I gain insight from `bucketManager().info().raw()`? – Ori Dar Dec 28 '17 at 08:07
  • When you say for reporting, do you mean you aggregate what many clients see, or just use one client's perspective? If the former, the health check is exactly what you need and a version of it is in the current client. I can't recommend monitoring from one client, other than perhaps looking at the bucket info as you suggest. – Matt Ingenthron Dec 28 '17 at 17:33
  • By reporting I meant a Smoke Test which called the above API and logged a message such as "some hosts are down" Nothing crucial or Cardinal. – Ori Dar Dec 28 '17 at 17:40
  • Edited my answer to reflect the experimental health check and coming diagnostics being the solution. – Matt Ingenthron Dec 28 '17 at 20:53

1 Answers1

3

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.

avsej
  • 3,822
  • 4
  • 26
  • 31
Matt Ingenthron
  • 1,894
  • 14
  • 14