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

It seems that in my Cassandra setup, the wrong implementation of the key space fails, I need some troubleshooting ideas. I set up a multicomponent data center cluster, but first I set up the keyspace to use SimpleStrategy with RF 3.

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 can not request 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 set up the setup of several data centers:

  • Use 2 nodes from each DC in the seed list
  • Use org.apache.cassandra.locator.GossipingPropertyFileSnitch for Snitch.
  • Specify a different name for DC in the cassandra-rackdc.properties file, as appropriate for node

This creates the keyspace:

 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 fix this problem?

+6
source share
2 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 want to use replication in data centers (DC), you need to use NetworkTopologyStrategy , for example, for example:

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

According to the following documentation link: "Use NetworkTopologyStrategy when you (or plan to have) a cluster deployed in multiple data centers ..."

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

+4
source

First, run the command below on any of your nodes:

describe keypace system_auth ;

Check out the class of this SimpleStrategy , be it SimpleStrategy or NetworkTopologyStrategy .

It must be NetworkTopologyStrategy if you configured Cassandra for multiple domain controllers.

If the result returns the class as SimpleStrategy, you need ALTER this keyspace .

COMMAND:

ALTER KEYSPACE "system_auth" WITH REPLICATION = 'class': 'NetworkTopologyStrategy', 'dc1': 3, 'dc2': 2};

After that, try creating a new keyspace to verify. You will no longer receive the consistency that you encounter.

-1
source

Source: https://habr.com/ru/post/977680/


All Articles