Cassandra Vnodes and token Ranges

后端 未结 1 1137
一整个雨季
一整个雨季 2020-12-16 04:00

I know that Vnodes form many token ranges for each node by setting num_tokens in cassandra.yaml file.

say for example (a), i have 6 nodes, each node i have set num_t

相关标签:
1条回答
  • 2020-12-16 04:45

    Every partition key in Cassandra is converted to a numerical token value using the MurMur3 hash function. The token range is between -2^63 to +2^63 -1 num_token defines how many token ranges are assigned to a node. this is the same as the signed java long. Each node calculates 256 (num_tokens) random values in the token range and informs other nodes what they are, thus when a node needs to coordinate a request for a specific token it knows which nodes are responsible for it, according to the Replication Factor and DC/rack placement. A better description for this feature would be "automatic token range assignment for better streaming capabilities", calling it "virtual" is a bit confusing. In your case you have 6 nodes, each set with 256 token ranges so you have 6*256 token ranges and each psychical node contains 256 token ranges.

    For example consider 2 nodes with num_tokens set to 4 and token range 0 to 100. Node 1 calculates tokens 17, 35, 77, 92 Node 2 calculates tokens 4, 25, 68, 85 The ring shows the distribution of token ranges in this case Node 2 is responsible for token ranges 4-17, 25-35, 68-77, 85-92 and node 1 for the rest.

    0 讨论(0)
提交回复
热议问题