我有一个运行的cassandra集群,它以单一的数据中心模式安装了ApacheCassandra3.7。
CQLSH问题:当我描述列族时,我看到列名是正确显示的,但是看到所有列名都以‘u’作为前缀:
cassandra@cqlsh> describe cassandra_test.employee;
CREATE TABLE cassandra_test.employee (
employee_id text PRIMARY KEY,
employee_grp_cd text,
employee mbrp_id text )
WITH bloom filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = "
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max threshold': '32', emin_threshold': '4'}
AND compression = fichunk_length_in_kb1: '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'l
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in ms = 0
AND min_indexinterval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
cassandra@cqlsh> select * from cassandra_test.employee;
u'employee_id' | u'employee_grp_cd' | u'employee_mbrp_id'
---------------+--------------------+----------------------
(0 rows)
Failed to format value u'employee_id' : 'unicode' object has no attribute 'formatter'
Failed to format value u'employee_grp_cd' : 'unicode' object has no attribute 'formatter' 1 more decoding errors suppressed. cassandra@cqlsh> 0
1 more decoding errors suppressed.当我插入记录并进行选择时,插入的值是,也是以'u‘作为前缀的。我做了几次尝试,每个相关的链接似乎都指出了python的问题。
我现在的python版本:Python2.7.11 ::Anaconda4.0.0(64位),我做了一个pip install cassandra-driver来安装Cassandra驱动程序缺少的依赖项。这并没有解决这个问题。
任何帮助都是非常感谢的。我花了很长的时间来解决这个问题,希望能在这里得到一些答案:)
发布于 2019-05-01 02:15:57
可能的原因:您的cqlsh路径是/usr/local/bin/cqlsh,它可能是由pip安装的。(使用命令$ which cqlsh检查哪个cqlsh )
解决方案:使用Cassandra附带的/usr/bin/cqlsh将您的Cassandra节点连接到命令:
$ /usr/bin/cqlsh <ip>然后查询检查结果,前缀'u‘将消失。
https://stackoverflow.com/questions/42631439
复制相似问题