得到错误"无法实现一致性等级ONE"在尝试在DSE Cassandra中插入记录时

时间:2016-08-31 13:40:48

标签: datastax-enterprise datastax-startup datastax-search

我正在使用DSE Cassandra并希望使用solr_query,因此创建了Keyspace如下:

create keyspace demo with replication = {'class': 'NetworkTopologyStrategy', 'Solr': 3};

创建下表:

create table demo.onlinetransactions 
( unique_tran_id text, user_id text, account_type text, 
account_id text, create_ts timestamp, data text, 
primary key (unique_tran_id) );

但是,当我尝试在此表中插入记录时,我收到错误,如下所述:

insert into demo.onlinetransactions (unique_tran_id, user_id, 
account_type, account_id, create_ts, data) 
values ('trans1', 'user1', 'creditcard', 
'1234567890123451', '2015-01-01 09:00:00', '{amount:100.00,vendor:Amazon}');

错误:

NoHostAvailable: ('Unable to complete the operation against any hosts',
{<Host: 127.0.0.1 dc0>: Unavailable('Error from server: code=1000
[Unavailable exception] 
message="Cannot achieve consistency level ONE" 
info={\'required_replicas\': 1, \'alive_replicas\': 0, 
      \'consistency\': \'ONE\'}',)})

我需要通过哪些配置设置验证我是否能够使用&#34; NetworkTopologyStrategy&#34;在键区空间中插入记录?和#34; Solr&#34;设定吗

此外,我可以在键空间中插入记录,如下所示(但这不是我想要使用的Solr。):

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

1 个答案:

答案 0 :(得分:2)

在KeySpace中指定正确的数据中心名称之后,solr_query使用NetworkTopologyStrategy作为复制策略。