什么是虚拟节点。以及如何在Cassandra分区中提供帮助 [英] What is virtual nodes. and how it is helping during partitioning in Cassandra

查看:296
本文介绍了什么是虚拟节点。以及如何在Cassandra分区中提供帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我们可以使用Cassandra的虚拟节点功能,这样我们就可以避免将令牌(起始令牌)分配给群集的不同节点的额外开销。取而代之的是,我们使用num token及其默认值256。

这些虚拟节点以何种方式在分区上有所作为? Meas Cassandra正在为特定节点设置/分配令牌范围(最大和最小令牌)?

I know we can use Cassandra's virtual node facility so that we can prevent additional overhead of assigning token (start token) to different nodes of cluster. Instead of that we use num token and its default values 256.
In what way these virtual nodes is making difference in partitioning? Meas Cassandra is setting/assigning token range(max and minimum token) for a particular node?

推荐答案


什么是虚拟节点?

What is virtual nodes?

在Cassandra 1.2之前,每个节点都分配有特定的令牌范围。现在,每个节点都可以支持多个非连续的令牌范围。它不是负责一个较大范围的令牌的节点,而是负责许多较小范围的令牌。通过这种方式,一个物理节点实际上托管着许多较小的虚拟节点。

Prior to Cassandra 1.2, each node was assigned to a specific token range. Now each node can support multiple, non-contiguous token ranges. Instead of a node being responsible for one large range of tokens, it is responsible for many smaller ranges. In this way, one physical node is essentially hosting many smaller "virtual" nodes.


这些虚拟节点以何种方式在分区方面有所作为?

In what way these virtual nodes is making difference in partitioning?

考虑此文档中的图片:如何在群集中(使用虚拟节点)分布数据。每个物理节点上都有许多较小的令牌范围(节点),可以更均匀地分配数据。当您向集群添加物理节点时,这变得显而易见,因为不再需要重新平衡(手动重新分配令牌范围)。正如虚拟节点文档所述,新节点承担了责任。来自群集中其他节点的部分数据。

Consider the image in this doc: How data is distributed across a cluster (using virtual nodes). Having many smaller token ranges (nodes) on each physical node allows for a more even distribution of data. This becomes evident when you add a physical node to the cluster, in that rebalancing (manually reassigning token ranges) is no longer necessary. As the Virtual Node documentation states, the new node "assumes responsibility for an even portion of data from the other nodes in the cluster."


Cassandra正在为特定的令牌设置/分配令牌范围(最大和最小令牌)

Cassandra is setting/assigning token range(max and minimum token) for a particular node?

是的,Cassandra预先确定了每个虚拟节点的大小。但是,您可以控制分配给每个物理节点的虚拟节点的数量。假设所有物理节点均配置为默认的256个虚拟节点。如果添加的新计算机资源比当前节点多,并且希望该计算机处理更多负载,则可以将其配置为允许384个虚拟节点。同样,可以将资源较少的机器配置为支持较少数量的虚拟节点。

Yes, Cassandra predetermines the size of each virtual node. However, you can control the number of virtual nodes assigned to each physical node. Assume that your physical nodes are all configured for the default of 256 virtual nodes. If you add a new machine with more resources than your current nodes, and you want that machine to handle more load, you could configure it to allow 384 virtual nodes instead. Likewise, a machine with fewer resources could be configured to support a smaller number of virtual nodes.

这篇关于什么是虚拟节点。以及如何在Cassandra分区中提供帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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