Cluster connection status monitoring


#1

Hello,

I am using Java SDK 2.6 and I am looking for a way to collect information about the cluster including health status, kv, query , index nodes etc…
In addition, is it possible to listen to the changes in the cluster connection status?

Please advice,
Thanks,
Igor Sandler


#2

Hi Igor,

CouchbaseCluster.diagnostics() returns information about the state of the cluster. There’s also Bucket.ping(). Sample usage and output are shown in this other thread:

Thanks,
David


#3

Hi David,

I am using 2.x java client with CouchbaseCluster replaced by Cluster interface. When I call diagnosticts() I am getting the following response:

diagnostics:[{
“services” : { },
“sdk” : “couchbase-java-client/2.5.4 (git: 2.5.4, core: 1.5.4) (Windows 7/6.1 amd64; Java HotSpot™ 64-Bit Server VM 1.8.0_152-b16)”,
“id” : “d8a769d7-6ca2-4680-980a-281dd609165a”,
“version” : 1
}]

The ‘services’ tag comes back empty. In addition Bucket interface does not have ‘ping’ method.

Your thoughts?
Thanks,
Igor


#4

Hi Igor,

Hmmm… Cluster.diagnostics() only reports on established connections. If the client hasn’t actually connected to the services yet, you won’t see any results.

Bucket.ping() was added in SDK 2.5.5. It actively connects to all services, so it’s probably the better tool for this use case.

Thanks,
David


#5

And, if I recall correctly, we promoted this from uncommitted API to commited API in 2.6, so you’re much better off using 2.7 (current) or 2.6.


#6

Thank you very much!
It works as expected with 2.6.

Igor