Trying to login to cassandra's console (cqlsh) and it rejects me

Charlie Parker picture Charlie Parker · Mar 6, 2014 · Viewed 9.5k times · Source

I was trying to set up the user authentication for cassandra when I had the following problem.

First I have updated the cassandra.yaml with:

authenticator: PasswordAuthenticator

then created the system_auth keyspace with a replication_factor of 3 as:

CREATE KEYSPACE system_auth WITH REPLICATION =  { 'class' : 'SimpleStrategy', 'replication_factor' : 3};

Then re-ran cassandra with the command:

bin/cassandra

Then after all that, I proceeded and made sure to repair my node(s) with (though I am not sure if I understand why this is important/necessary):

nodetool repair

Even after doing all of those steps cassandra/java yells at me with:

    Traceback (most recent call last):
  File "/home/tscobb/Documents/BM/apache-cassandra-2.0.5/bin/cqlsh", line 2044, in <module>
    main(*read_options(sys.argv[1:], os.environ))
  File "/home/tscobb/Documents/BM/apache-cassandra-2.0.5/bin/cqlsh", line 2030, in main
    display_float_precision=options.float_precision)
  File "/home/tscobb/Documents/BM/apache-cassandra-2.0.5/bin/cqlsh", line 480, in __init__
    cql_version=cqlver, transport=transport)
  File "/home/tscobb/Documents/BM/apache-cassandra-2.0.5/bin/../lib/cql-internal-only-1.4.1.zip/cql-1.4.1/cql/connection.py", line 143, in connect
  File "/home/tscobb/Documents/BM/apache-cassandra-2.0.5/bin/../lib/cql-internal-only-1.4.1.zip/cql-1.4.1/cql/connection.py", line 59, in __init__
  File "/home/tscobb/Documents/BM/apache-cassandra-2.0.5/bin/../lib/cql-internal-only-1.4.1.zip/cql-1.4.1/cql/thrifteries.py", line 157, in establish_connection
  File "/home/tscobb/Documents/BM/apache-cassandra-2.0.5/bin/../lib/cql-internal-only-1.4.1.zip/cql-1.4.1/cql/cassandra/Cassandra.py", line 465, in login
  File "/home/tscobb/Documents/BM/apache-cassandra-2.0.5/bin/../lib/cql-internal-only-1.4.1.zip/cql-1.4.1/cql/cassandra/Cassandra.py", line 486, in recv_login
cql.cassandra.ttypes.AuthenticationException: AuthenticationException(why='org.apache.cassandra.exceptions.UnavailableException: Cannot achieve consistency level QUORUM')

Honestly, at this point I am not sure how to proceed. If anyone has any ideas, it would be greatly appreciated.

I am running cassandra 2.0.5 in a Ubuntu vm. Not sure if that helps at all.

Also, when I run:

nodetool status

The following comes up:

nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address Load    Tokens  Owns   Host ID                              Rack
UN  127.0.0.1  1.57 MB  256     100.0%  37ae1d4c-0df5-43d2-9593-4603ac68c34a  rack1

Answer

Aaron picture Aaron · Mar 6, 2014
'class' : 'SimpleStrategy', 'replication_factor' : 3

As you only have one node in your cluster, setting a replication factor of 3 would be your problem. Here is an article that describes replication in Cassandra. You should give it a quick read through. One part in particular applies here:

When replication factor exceeds the number of nodes, writes are rejected, but reads are served as long as the desired consistency level can be met.

Cannot achieve consistency level QUORUM

Cassandra computes "Quorum" as (replication_factor / 2) + 1. So if you have a replication factor of 3, then 2 nodes need to be running for your consistency level to be met.

Basically, set your replication factor back down to 1, and you should be fine.