本文介绍了Cassandra中的数据重新分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为此,我想到了vNode。感谢'Simon Fontana Oscarsson'

As a follow up of this Data Partition in Cassandra, I got the idea of the vNodes. Thanks to 'Simon Fontana Oscarsson'

当我尝试使用vNode探索数据分区时,我有几个问题,

When I try to explore the data partitioning using vNodes, I have few questions,

我尝试观察2个节点中的分区分布( ./ nodetool ring

I try to observe the partition distribution in 2 node (./nodetool ring)

Two seed nodes (2 node)

172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -9207297847862311651
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -9185516104965672922
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -9135483708655236026
172.30.56.60  rack1       Up     Normal  102.77 KiB      100.00%             -9106737079237505681
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -9078521344187921602
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -9051897156173923903
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -9049800264451581717
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -9039572936575206977
172.30.56.60  rack1       Up     Normal  102.77 KiB      100.00%             -9019927187583981555
172.30.56.60  rack1       Up     Normal  102.77 KiB      100.00%             -9006071175095726599
172.30.56.60  rack1       Up     Normal  102.77 KiB      100.00%             -8995415525773810853
172.30.56.60  rack1       Up     Normal  102.77 KiB      100.00%             -8949342263103866059
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -8880432529087253108
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -8859265089807316498
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -8844286905987198633
172.30.56.61  rack1       Up     Normal  105.19 KiB      100.00%             -8832739468389117376

因此,根据我在两个节点中的观察,随着范围的扩大,节点61的值从-9207297847862311651到-9185516104965672922。

So as per my observation in two nodes, The Node 61 has the values from -9207297847862311651 to -9185516104965672922 as one range goes on...

注意:分区范围从'-9039572936575206977'到'-9019927187583981554'当前由Node 61处理。

现在我要向集群添加一个节点(而不是种子节点),然后运行 ./ nodetool ring

Now I am adding one more node to the cluster (not the seed node) and I ran ./nodetool ring,

Two seed nodes with one new node (3 node)

172.30.56.61  rack1       Up     Normal  104.12 KiB      64.73%              -9207297847862311651
172.30.56.61  rack1       Up     Normal  104.12 KiB      64.73%              -9185516104965672922
172.30.56.61  rack1       Up     Normal  104.12 KiB      64.73%              -9135483708655236026
172.30.56.60  rack1       Up     Normal  102.77 KiB      63.57%              -9106737079237505681
172.30.56.61  rack1       Up     Normal  104.12 KiB      64.73%              -9078521344187921602
172.30.56.61  rack1       Up     Normal  104.12 KiB      64.73%              -9051897156173923903
172.30.56.61  rack1       Up     Normal  104.12 KiB      64.73%              -9049800264451581717
172.30.56.61  rack1       Up     Normal  104.12 KiB      64.73%              -9039572936575206977
172.30.56.62  rack1       Up     Normal  103.7 KiB       71.70%              -9031848008695747480
172.30.56.62  rack1       Up     Normal  103.7 KiB       71.70%              -9028974600706382491
172.30.56.60  rack1       Up     Normal  102.77 KiB      63.57%              -9019927187583981555

现在,我观察到相同的分区范围已分配给新节点Node 62,
,范围从-9039572936575206977到-9031848008695747480由Node 61处理,但从-9031848008695747480到-9019927187583981555由节点62(新节点)处理,

Now I observed that same partition range is given to the new node Node 62,i.e, range from -9039572936575206977 to -9031848008695747480 is handled by Node 61 but -9031848008695747480 to -9019927187583981555 is handled by Node 62 (New node),

1)那么这是否意味着在集群中添加新节点将分配现有分区范围?

1) So does this mean that, adding a new node in the cluster will distribute the existing partition range?

2)是否可以使用诸如nodetool之类的任何工具观察Cassandra中的复制分区?

2) Is there a way to observe the replicated partitions in Cassandra using any utility like nodetool?

3)我有3个节点,RF为2,如何仅在节点62上看到数据可用?

3) I have 3 nodes with RF as 2, How to see the data's available in a node 62 alone?

推荐答案

1)添加节点时,Cassandra将从为新节点接管的良好范围开始。然后,它将创建256个新令牌范围,这些范围只是现有令牌范围的一部分。这意味着新节点从群集中的许多节点中获取令牌(而不是不使用vnode时,每个RF只能获取一个令牌),这使得大量流式传输更快。

1) When adding a node Cassandra will start by choosing good ranges for the new node to take over. It will then create 256 new token ranges that are just portions of the already existing ones. This means the new node takes tokens from many nodes (instead of only one per RF when not using vnodes) in the cluster which makes streaming alot faster.

2和3)这能回答您的问题吗?

2 and 3) Does this answer your questions? determine node of a partition in Cassandra

这篇关于Cassandra中的数据重新分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 05:51