Getting cluster metadata #70
stefanofornari
started this conversation in
Ideas
Replies: 1 comment
-
Hello @stefanofornari Normally, the cluster metadata should already be accessible via the Please note that the code you provided seems to use an old version of the Java driver, so the way to retrieve the token ranges is now slightly different in the version 4.x. Using the method specified above, you should get something like this: CassandraConnection connection; // Assuming you already declared your connection previously.
for (Node node : connection.getClusterMetadata().getNodes().values()) {
Set<TokenRange> tokenRanges = connection.getClusterMetadata().getTokenMap().get().getTokenRanges(node);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a use case where I need to know the toke range each node of the cluster manages. This is done with the java driver as follows:
I could not find a way to get the same information with the java wrapper. This forces me to use both, the java driver to get the ranges and then the wrapper for everything else. Would it be an idea to have a
getClusterMetadata()
returning the same ascluster.getMetadata()
above? of course it would be specific to cassandra, but I do not think this would be a problem.Beta Was this translation helpful? Give feedback.
All reactions