How to get information about cluster's node status?


#1

I want to get information about node status using Java API. But I only found method getAvailableServers() in CouchbaseClient class. It’s not quite what I need because this method considers the node available if its condition is not down (red status). But I can’t work in normal mode with Couchbase client, even if the status of the node is unhealthy (yellow status). Is there a method that provides detailed information about node’s status, something like this comand of curl curl -u admin:password 10.4.2.4:8091/pools/nodes


#2

This seems to be enough for our purposes:

CouchbaseConnectionFactoryBuilder builder = new CouchbaseConnectionFactoryBuilder();

List observers = (List)builder.getInitialObservers();

observers.add(new ConnectionObserver() {
void connectionEstablished(SocketAddress sa, int reconnectCount) {
//do the white magic
}
void connectionLost(SocketAddress sa) {
//do the black magic
}
});

PS: Big brother is watching you :slight_smile:


#3

The implementation of getInitialObservers is:

public Collection getInitialObservers() {
return Collections.emptyList();
}

So it won’t work.
PS: Small brother is following you. =)