为什么从 Cassandra CLI 教程中进行剪切和粘贴不起作用?

发布于 2024-12-11 01:47:04 字数 817 浏览 0 评论 0原文

盲目关注http://wiki.apache.org/cassandra/Cas​​sandraCli,有人可以解释一下吗这?

aaron-mac:apache-cassandra-1.0.0 aaron$ bin/cassandra-cli -host localhost -port 9160
Connected to: "Test Cluster" on localhost/9160
Welcome to the Cassandra CLI.

Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.

[default@unknown] use Keyspace1;
Authenticated to keyspace: Keyspace1

[default@Keyspace1] create column family User with comparator = UTF8Type; 
5ef4bad0-fb2a-11e0-0000-242d50cf1ffd
Waiting for schema agreement...
... schemas agree across the cluster
[default@Keyspace1] set User['jsmith']['first'] = 'John'; 
org.apache.cassandra.db.marshal.MarshalException: cannot parse 'jsmith' as hex bytes
[default@Keyspace1] 

Blindly following http://wiki.apache.org/cassandra/CassandraCli, and can someone please explain this?

aaron-mac:apache-cassandra-1.0.0 aaron$ bin/cassandra-cli -host localhost -port 9160
Connected to: "Test Cluster" on localhost/9160
Welcome to the Cassandra CLI.

Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.

[default@unknown] use Keyspace1;
Authenticated to keyspace: Keyspace1

[default@Keyspace1] create column family User with comparator = UTF8Type; 
5ef4bad0-fb2a-11e0-0000-242d50cf1ffd
Waiting for schema agreement...
... schemas agree across the cluster
[default@Keyspace1] set User['jsmith']['first'] = 'John'; 
org.apache.cassandra.db.marshal.MarshalException: cannot parse 'jsmith' as hex bytes
[default@Keyspace1] 

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

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

发布评论

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

评论(3

天气好吗我好吗 2024-12-18 01:47:04

在 Cassandra CLI 中运行任何 set 命令之前,始终建议执行以下操作:

assume <column_family> keys as utf8;
assume <column_family> comparator as utf8;
assume <column_family> validator as utf8;

这将确保您设置和列出的所有内容都将被理解

P.S:这仅适用于 Cassandra 新手

Before you run any set command in Cassandra CLI, it is always advisable to do the following :

assume <column_family> keys as utf8;
assume <column_family> comparator as utf8;
assume <column_family> validator as utf8;

This will ensure that everything you set and list will be understood

P.S : This is only for newcomers to Cassandra

暮色兮凉城 2024-12-18 01:47:04

这是针对旧版本的 Cassandra。默认情况下,键现在被视为十六进制字节,因此您需要:

set User[utf8('jsmith')]['first'] = 'John';

或执行:

assume User keys as utf8;
set User['jsmith']['first'] = 'John';

或者,如文档中的注释所述:

注意:从 Cassandra 0.8 开始,我们需要为列族声明一个 key_validation_class:

update column family User with key_validation_class=UTF8Type;

That's for an older version of Cassandra. Keys are now treated as hex bytes by default, so you need:

set User[utf8('jsmith')]['first'] = 'John';

or do:

assume User keys as utf8;
set User['jsmith']['first'] = 'John';

Or, as the note in the doc says:

Note: As of Cassandra 0.8, we need to declare a key_validation_class for the column family:

update column family User with key_validation_class=UTF8Type;
缱倦旧时光 2024-12-18 01:47:04
set User['jsmith'][utf8('first')] = utf8('John');

如果您不确定 set 命令,您可以输入 help set;,它将显示完整的文档。

set User['jsmith'][utf8('first')] = utf8('John');

If you're unsure about the set command you can type help set; and it'll show the full documentation.

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