Reputation: 455
When I create a session for Cassandra cluster using datastax driver Cluster java class, I need to find for a particular session which data node is used as coordinator node.
I tried session.getState().getConnectedHosts() but this is giving all data nodes in my cluster.
Actually at one point of time there will be only one coordinator node which is used. Can anyone please help me to find the coordinator node with java code.
Thanks.
Upvotes: 1
Views: 1196
Reputation: 7365
After running a query, ResultSet.getExecutionInfo() returns ExecutionInfo. http://www.datastax.com/drivers/java/2.0/com/datastax/driver/core/ResultSet.html
This has the coordinator host you're after. http://www.datastax.com/drivers/java/2.0/com/datastax/driver/core/ExecutionInfo.html#getQueriedHost()
Upvotes: 3