Getting node ip when having exception

Hi,

We are using client 2.1.6 and want to know please if there is any way to get the node ip when we get exception(e.g. timeout exception) because it will be better for us to know from which node we got timeout exception and check the hardware on this node/s.

Thanks,
Asaf.

Hi @asaf,

this is currently not possible straight away since the concept of a timeout is separate from the underlying transparent execution of the operation which includes figuring out which node to send it to (and it can even be in-flux during a failover or rebalance).

Now there is a way through a helper class that might help you to get what you need. Check out the com.couchbase.client.java.util.NodeLocatorHelper which you need to initialize with the Bucket reference you have after opening the bucket. You can then use the methods to get the hostnames for the active and/or replica nodes as InetAddress.

So in your code you can, for example when the timeout is triggered, check with this helper and pass in the id and it will tell you to which hostname it belongs.