Cassandra cli:将十六进制值转换为人类可读的格式 [英] Cassandra cli: Convert hex values into a human-readable format

查看:266
本文介绍了Cassandra cli:将十六进制值转换为人类可读的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 cassandra 开始,当我在列表或命令-tagtitle =显示问题标签'cassandra-cli'rel =tag> cassandra-cli ,我得到这样的结果:

Im starting with cassandra, and when I run list or get commands in cassandra-cli, I get results like this:

[default@usersdatabase] list users;
Using default limit of 100
-------------------
RowKey: boby
=> (column=6e616d65, value=426f62, timestamp=1294780856414000)
-------------------
RowKey: edzuksm
=> (column=656d61696c, value=6d617268656c697340696e626f782e6c76, timestamp=1294780533705000)
=> (column=6e616d65, value=45647561726473, timestamp=1294780488155000)
=> (column=7375726e616d65, value=4d617268656c6973, timestamp=1294780515429000)

2 Rows Returned.

我无法读取,我只看到像'6e616d65'这样的值。

I can't read it, I see only values like '6e616d65'.

如何以人类可读的格式显示这些值?

How can I display the values in a human-readable format?

推荐答案

,列名和列值在Cassandra中没有类型,它们只是字节数组。如果您设置了比较器类(列名类型)或验证类(列值类型),CLI将选择此选项,格式而不是十六进制版本的字节数组。

By default, column names and column values have no type in Cassandra, they are only byte arrays. If you set a comparator class (column name type) or validation class (column value type), the CLI will pick up on this and show you the data types in a sensible format instead of a hex version of the byte array.

如果你不想这个实际的数据类型,你可以告诉CLI假设列名或值使用假设命令创建一个特定的数据类型。键从不具有数据类型,因此假设必须在那里使用,如果你想使用一些数据类型。

If you don't want this actual data typing, you can tell the CLI to assume that column names or values are a certain data type by using the assume command. Keys never have a data type, so assume has to be used there if you want to work with some data types.

这里是帮助信息假设为参考:

Here's the help info on assume for reference:

[default@Keyspace1] help assume;    
assume <column_family> comparator as <type>;
assume <column_family> sub_comparator as <type>;
assume <column_family> validator as <type>;
assume <column_family> keys as <type>;

Assume one of the attributes (comparator, sub_comparator, validator or keys)
of the given column family to match specified type. Available types: bytes, integer,
long, lexicaluuid, timeuuid, utf8, ascii.
example:
assume Users comparator as lexicaluuid;

编辑:自Cassandra 0.8开始,您可以指定验证类键,CLI自动使用此信息。

As of Cassandra 0.8, you can specify a validation class for keys, and the CLI automatically makes use of this info.

这篇关于Cassandra cli:将十六进制值转换为人类可读的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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