Data Re-Partitioning in Cassandra

六月ゝ 毕业季﹏ 提交于 2019-12-24 19:26:51

问题


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

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

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      

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

NOTE : Partition range from '-9039572936575206977' to '-9019927187583981554' is currently handled by Node 61.

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    

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) So does this mean that, adding a new node in the cluster will distribute the existing partition range?

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

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


回答1:


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 and 3) Does this answer your questions? determine node of a partition in Cassandra



来源:https://stackoverflow.com/questions/47628499/data-re-partitioning-in-cassandra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!