Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started



nagasree963_193876 avatar image
nagasree963_193876 asked nagasree963_193876 commented

Why can't I login with cqlsh to DC2 of my cass-operator cluster?

I created 2 datacenters in one cluster. Below is datacenter1 yaml file

# Sized to work on 3 k8s workers nodes with 2 cores / 8 GB RAM
kind: CassandraDatacenter
name: dc1
clusterName: cluster1
serverType: cassandra
serverVersion: "3.11.6"
insecure: {}
size: 3
- name: rack1
- name: rack2
- name: rack3
memory: 4Gi
cpu: 1000m
storageClassName: server-storage
- ReadWriteOnce
storage: 10Gi
num_tokens: 8
authenticator: org.apache.cassandra.auth.PasswordAuthenticator
authorizer: org.apache.cassandra.auth.CassandraAuthorizer
role_manager: org.apache.cassandra.auth.CassandraRoleManager
initial_heap_size: "2G"
max_heap_size: "2G"
- "-Dcassandra.system_distributed_replication_dc_names=dc1"
- "-Dcassandra.system_distributed_replication_per_dc=3"

same yaml file I maintained for dc2, I just changed the datacenter name as dc2. Remaining was unchanged.Secret file will created by default. I can connect to cqlsh for 1st datacenter by using the default credentials. But, I was unable to connect to cqlsh for 2nd datacenter by using those default credentials. How can I connect to cqlsh for 2nd datacenter. I am getting the error as below:

Defaulting container name to cassandra.
Use 'kubectl describe pod/cluster1-dc2-rack1-sts-0 -n cass' to see all of the containers in this pod.
Connection error: ('Unable to connect to any servers', {'': AuthenticationFailed('Failed to authenticate to Error from server: code=0100 [Bad credentials] message="Unable to perform authentication: Cannot achieve consistency level LOCAL_ONE"',)})
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

saravanan.chinnachamy_185977 avatar image
saravanan.chinnachamy_185977 answered nagasree963_193876 commented

Hi @nagasree963_193876 Please try the following steps and let us know if that resolves the issue.

  1. Login to dc1 <cqlsh> shell.
  2. Alter the following key spaces.
    • alter keyspace system_auth with replication= {'class' : 'NetworkTopologyStrategy','dc1' : 3,'dc2' : 3};
    • alter keyspace dse_security with replication= {'class' : 'NetworkTopologyStrategy','dc1' : 3,'dc2' : 3};
  3. Login to each pod (in both dc1 and dc2) and run the following commands.
    • nodetool flush
    • nodetool repair
  4. Now try to connect to dc2 <cqlsh> shell.
1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thank you @sravanan.chinnachamy

It worked for me. Now, I am able to connect dc2<cq1sh> shell

1 Like 1 ·