Cassandra在哪个节点上存储数据? [英] What node does Cassandra store data on?

查看:188
本文介绍了Cassandra在哪个节点上存储数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有命令或任何方式可以知道在Cassandra的哪些节点上存储了什么数据?

Is there a command or any way at all to know what data is stored on what nodes of Cassandra?

对于Cassandra来说,我还很陌生,没有太多东西

Im pretty new to Cassandra and haven't had much luck googling this question.

谢谢!

推荐答案

Cassandra通过来告诉您特定键在哪个节点上nodetool getendpoints

You can get Cassandra to tell you which node(s) a particular key is on with nodetool getendpoints.

$ nodetool getendpoints mykeyspace tbl '8546200'
192.168.73.188
192.168.73.190

我不知道这是否是您要的东西。 AFAIK无法平整查询表或键空间中所有行的负责节点。但是正如Blake指出的那样,您的应用程序并不需要为此担心。

I don't know if that's what you're looking for or not. AFAIK there isn't a way to flat-out query the responsible nodes for all rows in a table or keyspace. But as Blake pointed out, your application doesn't really need to worry about that.

如果您真的想找出答案,则可以使用<$来查询表。分区键上的c $ c> token 函数。以下是使用布雷克模式的示例:

If you really wanted to find out, you could query your table using the token function on your partition key. Here's an example using Blake's schema:

SELECT token(partition_key),partition_key FROM tbl;

这将列出带有分区键的哈希标记。然后,您可以运行 nodetool环列出每个节点的令牌范围,并查看哪个节点负责该范围。请注意,如果您使用的是vNode,则输出将非常大(默认情况下,每条输出256行)。

That would list the hashed tokens with your partition keys. Then you could run a nodetool ring to list out the token ranges for each node, and see which nodes are responsible for that range. Note that if you are using vNodes your output will be pretty big (256 lines for each, by default).

这篇关于Cassandra在哪个节点上存储数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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