Cassandra Vnodes 和令牌范围 [英] Cassandra Vnodes and token Ranges

查看:28
本文介绍了Cassandra Vnodes 和令牌范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 Vnode 通过在 cassandra.yaml 文件中设置 num_tokens 为每个节点形成许多令牌范围.

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

例如(a),我有 6 个节点,每个节点我都设置了 num_token=256.这6个节点之间形成了多少个虚拟节点,即每个物理节点包含多少个虚拟节点或子令牌范围.

say for example (a), i have 6 nodes, each node i have set num_token=256. How many virtual nodes are formed among these 6 nodes that is, how many virtual nodes or sub token ranges contained in each physical node.

根据我的理解,当每个节点都分配了num_token为256时,就意味着所有6个节点每个都包含256个vnode.这个说法是真的吗?如果不是,那么 vnode 如何在每个节点中形成令牌范围(显然是随机的).如果有人能用 (a) 中提到的例子来解释我,那真的很方便.

According to my understanding, when every node has assigned num_token as 256, then it means that all the 6 nodes contain 256 vnodes each. Is this statement true? if not then, how vnodes form the range of tokens (obviously random) in each node. It would be really convenient if someone can explain me with the example mentioned as (a).

这个 url 中的 Vnodes 环是什么意思:=> http://docs.datastax.com/en/cassandra/3.x/cassandra/images/arc_vnodes_compare.png(取自:http://www.datastax.com/dev/blog/virtual-nodes-in-cassandra-1-2 )

what is the Ring of Vnodes signify in this url:=> http://docs.datastax.com/en/cassandra/3.x/cassandra/images/arc_vnodes_compare.png (taken from: http://www.datastax.com/dev/blog/virtual-nodes-in-cassandra-1-2 )

推荐答案

Cassandra 中的每个分区键都使用 MurMur3 哈希函数转换为数字标记值.令牌范围在 -2^63 到 +2^63 -1 之间num_token 定义了分配给节点的令牌范围的数量.这与已签名的 java long 相同.每个节点计算令牌范围内的 256 个(num_tokens)随机值并通知其他节点它们是什么,因此当节点需要协调对特定令牌的请求时,它知道哪些节点负责它,根据复制因子和 DC/机架放置.对此功能的更好描述是自动令牌范围分配以获得更好的流媒体功能",称其为虚拟"有点令人困惑.在你的例子中,你有 6 个节点,每个节点有 256 个标记范围,所以你有 6*256 个标记范围,每个心理节点包含 256 个标记范围.

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.

例如,考虑 num_tokens 设置为 4 且令牌范围为 0 到 100 的 2 个节点.节点 1 计算令牌 17、35、77、92节点 2 计算令牌 4、25、68、85在这种情况下,环显示了令牌范围的分布节点 2 负责令牌范围 4-17、25-35、68-77、85-92,节点 1 负责其余部分.

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.

这篇关于Cassandra Vnodes 和令牌范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆