Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra - Cannot achieve consistency level QUORUM

Tags:

cassandra

I'm running a single node at the moment. I'm trying to enable password authentication for Cassandra.

I'm following this guide: http://cassandra.apache.org/doc/latest/operating/security.html#password-authentication

I'll note that I didn't alter system_auth's replication as it's a single node cluster.

I edited cassandra.yaml to use authenticator: PasswordAuthenticator.

I then restarted cassandra and tried the command cqlsh -u cassandra -p cassandra, but that gives me the error:

Connection error: ('Unable to connect to any servers',
{'127.0.0.1': AuthenticationFailed(u'Failed to authenticate to 127.0.0.1: 
code=0100 [Bad credentials] message="org.apache.cassandra.exceptions.
UnavailableException: Cannot achieve consistency level QUORUM"',)})

I've tried running nodetool repair but it says: Replication factor is 1. No repair is needed for keyspace 'system_auth'

How do I solve this?

like image 657
J Del Avatar asked Jul 03 '17 11:07

J Del


2 Answers

I managed to solve the problem.

I had to run ALTER KEYSPACE system_auth WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; as it was set to {'class': 'NetworkTopologyStrategy', 'DC1': '1', 'DC2': '1'} previously, even though it was a single node cluster.

This is why it couldn't achieve a QUORUM.

like image 57
J Del Avatar answered Oct 11 '22 06:10

J Del


Follow the below steps:

  1. Set the authenticator in /etc/cassandra/cassandra.yaml file to AllowAllAuthenticator
  2. Restart the cassandra sudo service cassandra restart
  3. run the following commands cqlsh ALTER KEYSPACE system_auth WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
  4. Now change the authenticator again back to PasswordAuthenticator
  5. Restart the cassandra sudo service cassandra restart
  6. Now you will be able to login using the following command cqlsh -u cassandra -p cassandra

The issue is happening since a system_auth was set to {'class': 'NetworkTopologyStrategy', 'DC1': '1', 'DC2': '1'} previously, even though it was a single node cluster.

like image 45
Chirram Kumar Avatar answered Oct 11 '22 05:10

Chirram Kumar