我有一个可操作的cassandra集群,在单一数据中心模式下使用apache Cassandra 3.7的tarball安装。
CQLSH问题: 当我描述列系列时,我看到列名称已正确显示,但when I do a select on the table我看到所有列名都以' 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版本:Python 2.7.11 :: Anaconda 4.0.0(64位),我做了一个pip install cassandra-driver
来安装Cassandra驱动程序的任何缺少的依赖项。这还没有解决问题。
非常感谢任何帮助。我花了很多时间来弄清楚修复并希望我能在这里得到一些答案:)
答案 0 :(得分:0)
可能的原因:您的cqlsh路径为/usr/local/bin/cqlsh
,可能由pip安装。 (使用命令$ which cqlsh
检查哪个cqlsh)
解决方案:使用Cassandra随附的/usr/bin/cqlsh
用以下命令连接您的Cassandra节点:
$ /usr/bin/cqlsh <ip>
然后查询以检查结果,前缀'u'将消失。