Cassandra CLI:带有 RandomPartitioner 的 RowKey = 以明文形式显示密钥?

发布于 2024-11-27 06:52:22 字数 547 浏览 4 评论 0原文

使用 Cassandra CLI 给出以下输出:

RowKey: 31307c32333239
=> (super_column=3f18d800-fed5-17cf-b91a-0016e6df0376,
     (column=date, value=1312289229287, timestamp=1312289229647000)

我正在使用 RandomPartitioner。是否可以以明文形式获取 RowKey(从 CLI)?理想情况下在 CLI 中,但如果有一个帮助类将其转换回字符串,这也可以。

我知道密钥以某种方式被散列了。如果无法“检索”密钥(我必须假设),Cassandra 中是否公开了辅助类,我可以用它来根据原始字符串生成密钥来比较它们?

我的问题:我已将记录存储在 Cassandra 中,但使用像 "user1|order1" 这样的密钥我无法检索记录。 Cassandra 未找到任何记录。我认为我的钥匙是错误的,我需要比较它们并找出问题所在......

非常感谢!延斯

using Cassandra CLI gives me the following output:

RowKey: 31307c32333239
=> (super_column=3f18d800-fed5-17cf-b91a-0016e6df0376,
     (column=date, value=1312289229287, timestamp=1312289229647000)

I am using RandomPartitioner. Is it somehow possible to get the RowKey (from CLI) in Cleartext? Ideally in the CLI but if there is a Helper Class to convert it back into a String, this would also be ok.

I know the key is somehow hashed. If the key can not be "retrieved" (what I have to assume), Is there are helper Class exposed in Cassandra, that I can use to generate the Key based on my original String to compare them?

My Problem: I have stored Records in Cassandra, but using the Key like "user1|order1" I am not able to retrieve the records. Cassandra does not find any records. I assume that somehow my keys are wrong and I need to compare them and find out whtere the problem is...

Thanks very much !! Jens

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

隱形的亼 2024-12-04 06:52:22

这个问题高度相关:Cassandra cli:将十六进制值转换为人类可读的格式

唯一的区别是,在 Cassandra 0.8 中,现在每个列族都有一个“key_validation_class”属性,并且默认为 BytesType。当 CLI 发现它是 BytesType 时,它​​代表十六进制的密钥。

This question is highly relevant: Cassandra cli: Convert hex values into a human-readable format

The only difference is that in Cassandra 0.8, there is now a "key_validation_class" attribute per column family, and it defaults to BytesType. When the CLI sees that it's BytesType, it represents the key in hex.

清欢 2024-12-04 06:52:22

Cassandra 将您的 RowKey 视为十六进制字节:31 30 7c 32 33 32 39 十六进制为
ASCII 格式的 10|2329,我猜这是你的密钥。

如果您想在 CLI 中查看明文密钥,则需要输入命令 assume MyColumnFamily keys as ascii; 这将使 CLI 在行密钥中自动在 ASCII 和十六进制之间进行转换。

或者,在创建列族时,使用 create column family MyColumnFamily with key_validation_class = AsciiType; 这将永久设置首选项。

哈希发生在较低级别,不会影响您的问题。

Cassandra is treating your RowKey as hex bytes: 31 30 7c 32 33 32 39 in hex is
10|2329 in ASCII, which I guess is your key.

If you want to see your plaintext keys in the CLI, then you need to give the command assume MyColumnFamily keys as ascii; which will make the CLI automatically translate between ASCII and hex for you in the row keys.

Or, when you create the column family, use create column family MyColumnFamily with key_validation_class = AsciiType; which will set the preference permanently.

The hashing occurs at a lower level and doesn't affect your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文