初始令牌为cassandra无法正常工作

编程入门 行业动态 更新时间:2024-10-19 22:35:49
本文介绍了初始令牌为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无法正常工作

本文发布于:2023-11-01 12:47:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549372.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:令牌   无法正常   工作   cassandra

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!