gpt4 book ai didi

cassandra复合,多节点上的复合键

转载 作者:行者123 更新时间:2023-12-04 06:39:33 26 4
gpt4 key购买 nike

我最近在 cassandra 中用不同的设计做一些性能测试。
我目前使用 cassandra 作为写入密集型项目。但是,我将使用 select 添加读取密集型部分以导出数据。陈述。

我正在使用下表进行时间序列;

CREATE TABLE events (
date text,
n int, // it could be 1,2,3
id timeuuid,
PRIMARY KEY ((date, n), id)
);

我有 date|n作为分区键。为了提高读取性能,我试图利用宽行的概念。在文档中,它指出;

如果分区键相同,则将它们插入到同一个物理节点,并加宽分区键的行。

因此,我使用 n在获得热点的情况下均匀分布行 here ;

但是,在多节点集群中,当我插入以下内容时;
'2013-07-30'|1, some-timeuuid 
'2013-07-30'|1, another-timeuuid

我看到它们不在同一个物理节点中。

我通过以下方式获取节点信息;
nodetool getendpoint keyspace columnfamily some-timeuuid
所以,不知何故,我希望它们在同一行中以提高读取性能,但在获得 20 亿列的情况下不要太宽。 (这是列的大小限制)

那么,任何想法这里发生了什么?

最佳答案

如果没记错的话,为了找出您的行存储在哪些节点中,您需要运行:
nodetool getendpoints keyspace columnfamily 2013-07-30:1
使用您的(复合分区/)行键而不是列键。

如果您使用 SimpleStrategy 进行 token /副本计算,这将在内部发生:

You compute the MD5 hash of the key. Create sorted list of tokens assigned to the nodes in the ring. Find the first token greater than the hash. This is the first node. Next in the list is the replica, which depends on the RF.



(在 cassandra 邮件列表上找到了这个
http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/How-to-find-what-node-a-key-is-on-td6202253.html )

(根据评论更新了我的答案。)

关于cassandra复合,多节点上的复合键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17946378/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com