初始令牌为cassandra无法正常工作 [英] Initial Token is cassandra is not working as expected

查看:118
本文介绍了初始令牌为cassandra无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要了解没有vNode的环,我尝试将节点1中的初始令牌尝试为25,将节点2的初始令牌尝试为50,如下所示,

 地址机架状态状态拥有者令牌
50
172.30.56.60 rack1向上正常82.08 KiB 100.00%25
172.30.56.61 rack1向上正常82.09 KiB 100.00%50
  user_id | |提供以下信息(user_id-主键/分区键)。用户名| user_phone 
------------ + ----------- + ------------
999933333 | ram | 9003934069
111 | ram | 9003934069
1 | ram | 9003934069
111333333 | ram | 9003934069
1113333333 | ram | 9003934069

其中,user_id是主键/分区键。



这是否意味着initial_token中提供的令牌是令牌的总数而不是分区范围?



谢谢,
哈里

解决方案

令牌号是分区键的哈希。这决定了数据应存储在何处。



(参考:



在此图片中,N0被分配了令牌0,N1令牌10等等。通过这样做,我们说N1负责令牌范围1-10。但是,如果使用RF 3,则可以说N1负责令牌范围81-10。您在示例中所做的就是说60拥有51-25。由于总共还有2 ^ 127个令牌(取决于分区程序),因此与61个令牌相比,它现在拥有大量数据。


To understand the ring without vNodes, I tried initial token in Node 1 as 25 and Node 2 as 50 like below,

Address       Rack        Status State   Load            Owns                Token                                       
                                                                             50                                          
172.30.56.60  rack1       Up     Normal  82.08 KiB       100.00%             25                                          
172.30.56.61  rack1       Up     Normal  82.09 KiB       100.00%             50  

I expect only the partition ranges between 0 to 50 should be added in database, But It is allowing any primary key / partition key value I provide as follows (user_id - primary / partition key).

 user_id    | user_name | user_phone
------------+-----------+------------
  999933333 |       ram | 9003934069
        111 |       ram | 9003934069
          1 |       ram | 9003934069
  111333333 |       ram | 9003934069
 1113333333 |       ram | 9003934069

where, user_id is the primary / partition key.

Does it mean that token provided in initial_token is the total number of tokens and not the partition range? If so how the partition range is calculated?

Thanks, Harry

解决方案

The token number is a hash of the partition key. This decides where the data should be stored.

(ref:

In this picture N0 is assigned token 0, N1 token 10 and so on. By doing this we say N1 is responsible for token ranges 1-10. However if we use RF 3 then we say N1 is responsible for token ranges 81-10 instead. What you have done in your example is saying 60 owns 51-25. Since there is still a total of 2^127 tokens (depending on your partitioner) that means it now owns a huge amount of data compared to 61.

这篇关于初始令牌为cassandra无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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