Does Cassandra 2.0.6 not support ROLE in cqlsh? - cassandra

I encountered an issue with Cassandra 2.0.6.
I want to create a new role in Cassandra via cqlsh as following create role command. However, it returns Bad Request error message.
cqlsh> CREATE ROLE abc WITH SUPERUSER=true AND LOGIN=true AND PASSWORD='mypass';
Bad Request: line 1:7 no viable alternative at input 'ROLE'
I run the same command on Cassandra 2.2.x, it was good.
If anyone can help me understand the reason of it? Does Cassandra 2.0.6 not support ROLE in cqlsh?
If so, what is the alternative option?
Thank you so much!
Jun

Correct. Role Based Access Control (RBAC) was new to Cassandra in 2.2.
With 2.0, you’ll need to do a CREATE USER instead:
CREATE USER abc WITH PASSWORD='mypass' SUPERUSER;
That should work (2.0 also does not have the LOGIN option).
I answered a similar question back in the 2.0/2.1 days:
How do you create the first user in Cassandra DB

Related

How can I apply a schema.cql to a new DataStax Astra database keyspace?

I've got an existing Cassandra application I want to try in Datastax Astra. I've created my Astra database and am able to connect to it from NodeJS successfully. The next task I have is to apply my existing schema.cql to the keyspace.
It should be easy enough right? But never-the-less I can't see any obvious way to do this. Can someone walk me through it please. I can then I think use the dsbulk tool to upload a dataset.
Thanks in advance Astra experts.
Rod
The easiest way to do it is to cut-and-paste the CQL statements one-by-one into the CQL console and run them one at a time. This is what I would recommend since you have guarantees that each DDL statement has completed successfully before you can execute the next one.
Alternatively, you can download the Standalone CQL Shell to your laptop/desktop and run the cqlsh commands from there. You will need to configure it with your app token + secure connect bundle to be able to connect to your database.
For more info, see the instructions for Installing standalone cqlsh. Cheers!
Converting comment to answer:
Unauthorized('Error from server: code=2100 [Unauthorized]
message="No SELECT permission on <table system_virtual_schema.keyspaces>
What is the role you have created your token for in Astra DB? Otherwise, create a new one as "Database Administrator" and that should be able to SELECT FROM system_virtual_schema.keyspaces.
While creating use-specific roles is a good idea, only privileged roles can run data definition language (DDL) commands.

Cassandra PER PARTITION LIMIT not working throwing error in dev center

I am trying to run below CQL query in dev center (1.6) and seeing this error thus not allowing me to execute query. I verified DataStax documentation and I see syntax is correct. Any help please?
select * from some_table PER PARTITION LIMIT 1;
Error I see -> no viable alternative at input 'PER
If you're using DataStax Enterprise 6.x, then you need to use DataStax Studio instead of DevCenter. DSE 6 supports per partition limit without problems, it's a DevCenter that doesn't understand this syntax.
My guess is that you're using a version of Cassandra that does not support that syntax.

Authentication via username and password in Cassandra

In order to create a DBLink from Oracle to Cassandra, I am trying to have a connection in Cassandra via username and password.
By default, the installation of Cassandra does not ask for username.
Searching here, I found a topic where it is described the steps for that.
unfortunately, when I modify the authenticator and authorizer parameters, the Cassandra CQL Shell opens and immediately closes.
Cassandra Installer version: datastax-ddc-64bit-3.9.0.msi
OS: Windows 7
Can someone tell me how to solve this, please?
Thank you,
To Solve CQL Shell error edit cqlshrc file.
Default location in windows is C:\Users\USER\.cassandra where USER is windows username.
In cqlshrc file edit following:
[authentication]
;; If Cassandra has auth enabled, fill out these options
username = cassandra
password = cassandra
Note cassandra is default username & password which is also a superuser.

Cassandra opscenter not connecting to local cluster

The datastax has restricted the use of opscenter for enterprise users only. Is there any way or possibility that even an open source casandra user can have access to the opscenter? Kindly check the follwing image and let me know if there is any possibility of the usage or opscenter?
I am trying to connect it but gettng the following error:
No. However you could consider creating a monitor via the metrics exposed by JMX instead.

Is there a way to check the selected keyspace in Cassandra?

Is there a way to check the selected keyspace in Cassandra while using it through Java?
Context:
A subsystem uses authentication credentials to select a keyspace. I'm working on a DTO that executes commands. I have a hunch that i'm operating in the wrong keyspace (commands execute successfully in DevCenter but not within the Java code).
I'm new to Cassandra and this Java application so I apologize if this is a silly question.

Resources