Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you create the first user in Cassandra DB

Tags:

How does one create the first user in a cassandra database?

I tried:

CREATE USER username WITH PASSWORD ""; 

and its says:

Bad Request: Only superusers are allowed to perform CREATE USER queries 

But I have never created a user before this attempt, so how do you create the first user in a cassandra database?

This seems a little strange because it's like a chicken and egg problem, but people use Cassandra so I am sure there must be a solution somewhere.

like image 339
Charlie Parker Avatar asked Mar 06 '14 02:03

Charlie Parker


People also ask

What is default username and password for Cassandra?

If you decide to enable authentication on Cassandra, it uses the following default credentials: username = 'cassandra' password = 'cassandra'

How do I create a Cassandra database?

Step-1: login into cqlsh you can log in into the cqlsh using Cassandra default credential. Now, here before creating a database you first need login into cqlsh. you can check the cluster information after login into cqlsh.


1 Answers

Once you have enabled Authentication and Authorization, you can log-in (to your local Cassandra instance) as the default Cassandra admin user like this:

./cqlsh localhost -u cassandra -p cassandra 

If you are running Cassandra on a Windows Server, I believe you need to invoke it with Python:

python cqlsh localhost -u cassandra -p cassandra 

Once you get in, your first task should be to create another super user account.

CREATE USER dba WITH PASSWORD 'bacon' SUPERUSER; 

Next, it is a really good idea to set the current Cassandra super user's password to something else...preferably something long and incomprehensible. With your new super user, you shouldn't need the default Cassandra account again.

ALTER USER cassandra WITH PASSWORD 'dfsso67347mething54747long67a7ndincom4574prehensi562ble'; 

For more information, check out this DataStax article: A Quick Tour of Internal Authentication and Authorization Security in DataStax Enterprise and Apache Cassandra

like image 77
Aaron Avatar answered Dec 06 '22 22:12

Aaron