NoHostAvailable:, In elassandra on insert query with Network Topology Strategy

389 views Asked by At

In elassandra on insert query with Network Topology Strategy it show's 'no host available'.

cqlsh>CREATE KEYSPACE IF NOT EXISTS twitter WITH replication={ 'class':'NetworkTopologyStrategy', 'dc1':'1' };

cqlsh>CREATE TABLE twitter.user (
   name text,
   attrs map<text,text>,
   PRIMARY KEY (name)
);

cqlsh>INSERT INTO twitter.user (name,attrs) VALUES ('bob',{'email':'[email protected]','firstname':'bob'});

enter image description here nodetool statusenter image description here

another keyspace using same dc, show's this enter image description here

2

There are 2 answers

7
Ashraful Islam On BEST ANSWER

Change data center name of your keyspace to DC1

ALTER KEYSPACE twitter WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1' : 1};

Data Center name is case sensitive.


Edited

Two replication strategies are available:

  • SimpleStrategy: Use for a single data center only. If you ever intend more than one data center, use the NetworkTopologyStrategy.
  • NetworkTopologyStrategy: Highly recommended for most deployments because it is much easier to expand to multiple data centers when required by future expansion.
0
isaura almar On

'dc1' at the time of creating the keyspace should be the Datacenter name when you use nodetool status