Getting error "Cannot achieve consistency level ONE" while trying to insert record in DSE Cassandra

1.1k Views Asked by At

I am using DSE Cassandra and want to use solr_query so created the Keyspace as follows:

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

Created the following table:

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) );

However when I try to insert record in this table I am getting error as mentioned below:

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}');

Error:

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\'}',)})

What configuration settings do I need to verify for me to be able to insert records in the keyspace with "NetworkTopologyStrategy" and "Solr" setting?

Also I am able to insert records when the keyspace as follows (however this is not using Solr which I want to use.):

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

There are 1 best solutions below

0
Virendra On

After specifying the correct Data Center name in the KeySpace the solr_query worked with NetworkTopologyStrategy as replication strategy.