有没有办法查看使用vnodes的cassandra中每个节点的令牌范围? [英] Is there a way to see token ranges for each node in cassandra which uses vnodes?
问题描述
是否可以查看使用vnode的cassandra中每个节点的令牌范围?我不想看到通过发出nodetool环而获得的每个节点的令牌.我只想查看每个使用vnodes的节点的令牌游标.
Is there a way to see token ranges for each node in cassandra which used vnodes? I dont want to see token for each node which you get by issuing nodetool ring. I just want to see the token ranger for each node which uses vnodes.
推荐答案
给定节点的令牌范围将是键空间拓扑的函数.
The token ranges for a given node will be a function of a keyspace's topology.
Programmatically you can use the java-driver for this using Cluster.getMetadata().getTokenRanges(keyspace, host). The following code example shows retrieving all token ranges by host for a keyspace:
String keyspace = "mykeyspace";
for(Host host : cluster.getMetadata().getAllHosts()) {
Set<TokenRange> hostRanges = cluster.getMetadata().getTokenRanges(keyspace, host);
}
此外,您还可以通过org.apache.cassandra.db:type=StorageService#getRangeToEndpointMap|getRangeToRpcaddressMap(String)
这篇关于有没有办法查看使用vnodes的cassandra中每个节点的令牌范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!