cqlsh:nohostavailable错误cassandra update更新失败

t2a7ltrp  于 2021-06-13  发布在  Cassandra
关注(0)|答案(1)|浏览(388)

这是我的密钥空间

CREATE KEYSPACE db_space WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;

这是我的table

CREATE TABLE**db_space.user12**(
    id text PRIMARY KEY,
    details map<text, text>,
    services map<text, frozen<user_services>>
) WITH additional_write_policy = '99p'
    AND 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', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    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_index_interval = 128
    AND read_repair = 'BLOCKING'
    AND speculative_retry = '99p';

下面的查询有效

update user12 set details=details + {'name':'raj'} where id = '2';

但是当我试图用udt更新一个字段时

update user12 set services = {'1298182':{'id':'2','title':'2','description':'2'}} where id = '2';

出现错误,没有可用的主机
这个问题只发生在这个特定的领域?我在网上搜索,试着改变网络策略、集群名称、nodetool修复和许多cassandra重启。。显示错误

mf98qq94

mf98qq941#

您的查询不正确-udt中的字段名不应被引用,因此应如下所示:

update user12 set services = {'1298182':{id:'2', title:'2', description:'2'}} 
   where id = '2';

虽然我不知道为什么会显示nohostavailable,但您需要检查服务器端日志。注意 system.log 节点的。

相关问题