Hi Siddarth,

I would recommend running "nodetool describering keyspace_name" as its
output is much simpler to reason about :

Schema Version:9a091b4e-3712-3149-b187-d2b09250a19b

TokenRange:

TokenRange(start_token:1943978523300203561, end_token:2137919499801737315,
endpoints:[127.0.0.3, 127.0.0.6, 127.0.0.7, 127.0.0.2, 127.0.0.5,
127.0.0.1], rpc_endpoints:[127.0.0.3, 127.0.0.6, 127.0.0.7, 127.0.0.2,
127.0.0.5, 127.0.0.1], endpoint_details:[EndpointDetails(host:127.0.0.3,
datacenter:dc1, rack:r1), EndpointDetails(host:127.0.0.6, datacenter:dc2,
rack:r1), EndpointDetails(host:127.0.0.7, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.2, datacenter:dc1, rack:r1),
EndpointDetails(host:127.0.0.5, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.1, datacenter:dc1, rack:r1)])

TokenRange(start_token:6451470843510300950, end_token:7799236518897713874,
endpoints:[127.0.0.6, 127.0.0.4, 127.0.0.1, 127.0.0.3, 127.0.0.5,
127.0.0.2], rpc_endpoints:[127.0.0.6, 127.0.0.4, 127.0.0.1, 127.0.0.3,
127.0.0.5, 127.0.0.2], endpoint_details:[EndpointDetails(host:127.0.0.6,
datacenter:dc2, rack:r1), EndpointDetails(host:127.0.0.4, datacenter:dc2,
rack:r1), EndpointDetails(host:127.0.0.1, datacenter:dc1, rack:r1),
EndpointDetails(host:127.0.0.3, datacenter:dc1, rack:r1),
EndpointDetails(host:127.0.0.5, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.2, datacenter:dc1, rack:r1)])

TokenRange(start_token:-2494488779943368698,
end_token:-2344803022847488784, endpoints:[127.0.0.1, 127.0.0.4, 127.0.0.6,
127.0.0.5, 127.0.0.3, 127.0.0.2], rpc_endpoints:[127.0.0.1, 127.0.0.4,
127.0.0.6, 127.0.0.5, 127.0.0.3, 127.0.0.2],
endpoint_details:[EndpointDetails(host:127.0.0.1, datacenter:dc1, rack:r1),
EndpointDetails(host:127.0.0.4, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.6, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.5, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.3, datacenter:dc1, rack:r1),
EndpointDetails(host:127.0.0.2, datacenter:dc1, rack:r1)])

TokenRange(start_token:-3354341409828719744,
end_token:-3001704612215276412, endpoints:[127.0.0.7, 127.0.0.1, 127.0.0.4,
127.0.0.6, 127.0.0.3, 127.0.0.2], rpc_endpoints:[127.0.0.7, 127.0.0.1,
127.0.0.4, 127.0.0.6, 127.0.0.3, 127.0.0.2],
endpoint_details:[EndpointDetails(host:127.0.0.7, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.1, datacenter:dc1, rack:r1),
EndpointDetails(host:127.0.0.4, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.6, datacenter:dc2, rack:r1),
EndpointDetails(host:127.0.0.3, datacenter:dc1, rack:r1),
EndpointDetails(host:127.0.0.2, datacenter:dc1, rack:r1)])


It will give you the start and end token of each range (vnode) and the list
of the replicas for each (the first endpoint being the primary).

Hope this helps you figuring out your token distribution.

Alex

Le mar. 30 août 2016 à 09:11, Siddharth Verma <verma.siddha...@snapdeal.com>
a écrit :

> Hi,
> I saw that in cassandra-driver-core,(3.1.0) Metadata.TokenMap has
> primaryToTokens which has the value for ALL the nodes.
> I tried to find (primary)range ownership for nodes in one DC.
> And executed the following in debug mode in IDE.
>
> TreeMap<Long,Host> primaryTokenMap = new TreeMap<>();
> for(Host host :
> main.cluster.getMetadata().tokenMap.primaryToTokens.keySet()){
>     if(!host.getDatacenter().equals("dc2"))
>         continue;
>     for(Token token :
> main.cluster.getMetadata().tokenMap.primaryToTokens.get(host)){
>         primaryTokenMap.put((Long) token.getValue(),host);
>
>     }
> }
> primaryTokenMap //this printed the map in evaluate code fragment window
>
> dc2 has 3 nodes, RF is 3
> Sample entries :
> 244925668410340093 -> /10.0.3.79:9042
> 291047688656337660 -> /10.0.3.217:9042
> 317775761591844910 -> /10.0.3.135:9042
> 328177243900091789 -> /10.0.3.79:9042
> 329239043633655596 -> /10.0.3.135:9042
> ....
>
> Can I safely assume
> Token
> Range
> Host
> 244925668410340093 to 291047688656337660 -1 belongs to 10.0.3.79:9042
> 291047688656337660 to 317775761591844910 -1 belongs to 10.0.3.135:9042
> 317775761591844910 to 328177243900091789 -1 belongs to 10.0.3.135:9042
> And so on.
>
> Is the above assumption ABSOLUTELY correct?
> (Kindly suggest changes/errors, if any)
>
> Any help would be great.
> Thanks and Regards,
> Siddharth Verma
>

Reply via email to