为什么从 Cassandra CLI 教程中进行剪切和粘贴不起作用?
盲目关注http://wiki.apache.org/cassandra/CassandraCli,有人可以解释一下吗这?
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Cassandra CLI 中运行任何 set 命令之前,始终建议执行以下操作:
这将确保您设置和列出的所有内容都将被理解
P.S:这仅适用于 Cassandra 新手
Before you run any set command in Cassandra CLI, it is always advisable to do the following :
This will ensure that everything you set and list will be understood
P.S : This is only for newcomers to Cassandra
这是针对旧版本的 Cassandra。默认情况下,键现在被视为十六进制字节,因此您需要:
或执行:
或者,如文档中的注释所述:
注意:从 Cassandra 0.8 开始,我们需要为列族声明一个 key_validation_class:
That's for an older version of Cassandra. Keys are now treated as hex bytes by default, so you need:
or do:
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:
如果您不确定
set
命令,您可以输入help set;
,它将显示完整的文档。If you're unsure about the
set
command you can typehelp set;
and it'll show the full documentation.