Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot achieve consistency level ONE: info={ 'required_replicas': 1, 'alive_replicas': 0, 'consistency': 1}

It looks like keyspace replication is not happening correctly in my Cassandra setup, I need some ideas in troubleshooting this. I have configured multi datacenter cluster but to begin with I have set the keyspace to use SimpleStrategy with RF 3.

The column families exist:

cqlsh:kairosdb> select columnfamily_name from system.schema_columnfamilies where keyspace_name = 'kairosdb';

 columnfamily_name
-------------------
       data_points
     row_key_index
      string_index

(3 rows)

but I am unable to query on them:

cqlsh:kairosdb> select count(*) from data_points limit 100000;
 Traceback (most recent call last):
  File "/usr/bin/cqlsh", line 957, in perform_simple_statement
    rows = self.session.execute(statement, trace=self.tracing_enabled)
  File "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.1.1.post.zip/cassandra-driver-2.1.1.post/cassandra/cluster.py", line 1282, in execute
    result = future.result(timeout)
  File "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.1.1.post.zip/cassandra-driver-2.1.1.post/cassandra/cluster.py", line 2776, in result
    raise self._final_exception
Unavailable: code=1000 [Unavailable exception] message="Cannot achieve consistency level ONE" info={'required_replicas': 1, 'alive_replicas': 0, 'consistency': 1}

This is how I setup the multi datacenter setup:

  1. Use 2 nodes from each DC in the seeds list
  2. Use org.apache.cassandra.locator.GossipingPropertyFileSnitch for the Snitch
  3. Specify different name for DC in the cassandra-rackdc.properties as appropriate for the node

Here's the keyspace is created:

cqlsh:kairosdb> describe keyspace kairosdb;

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

Any ideas what I can do to troubleshoot this?

like image 351
vrtx54234 Avatar asked Nov 03 '14 22:11

vrtx54234


People also ask

How do you get consistency in cassandra?

Strong consistency can be achieved if W + R > RF, where R – read CL replica count, W – write CL replica count, RF – replication factor. In this scenario, you get a strong consistency since all client reads always fetches the most recent written data.

What is the default consistency level in cassandra?

Default READ and WRITE consistency is ONE in cassandra. Consistency can be specified for each query. CONSISTENCY command can be used from cqlsh to check current consistency value or set new consistency value.

What is consistency level?

A Consistency Level (CL) is a dynamic value which dictates the number of replicas (in a cluster) that must acknowledge a read or write operation in order for the coordinator node to determine the operation was successful. CLs can be used with any transaction including LWTs.


1 Answers

In your keyspace creation you have this syntax:

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

However if you wish to use replication across data centers (DC) then you need to use NetworkTopologyStrategy, so for example:

CREATE KEYSPACE kairosdb WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': 3, 'DC2': 3};

As per the following documentation link, "Use NetworkTopologyStrategy when you have (or plan to have) your cluster deployed across multiple data centers..."

http://www.datastax.com/documentation/cassandra/2.0/cassandra/architecture/architectureDataDistributeReplication_c.html

like image 55
markc Avatar answered Oct 18 '22 06:10

markc