Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 8 Materials and Homework.

Follow us on Eventbrite to get notified when new workshops are scheduled!


question

natrajan.rajasekaran_191958 avatar image
natrajan.rajasekaran_191958 asked ·

Why am I getting "nodetool: Failed to connect to '127.0.0.1:7199'" when connecting to my k8s cluster in the week 5 exercise?

[SPAWNED FROM QUESTION #7293]

I worked on the exercises for Cassandra on Kubernetes exercises at https://github.com/DataStax-Academy/cassandra-workshop-series/tree/master/week5-Cass-in-k8s

I tried do it in the cloud environment provided by datastax as well as on my laptop.

With laptop: I went up to step 4d successfully. When i tried 'nodetool status', I got

'nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused (Connection refused)'.

I tried the 'cqlsh cluster1-dc1-service.cass-operator -u cluster1-superuser -p <mypassword>', I got the below:

Traceback (most recent call last):
File "/opt/cassandra/bin/cqlsh.py", line 2443, in <module>
main(*read_options(sys.argv[1:], os.environ))
File "/opt/cassandra/bin/cqlsh.py", line 2421, in main
encoding=options.encoding)
File "/opt/cassandra/bin/cqlsh.py", line 485, in __init__
load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]),
File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/policies.py", line 417, in __init__
socket.gaierror: [Errno -2] Name or service not known.

Please provide me with the steps to reset the enviornment.

workshopcass-operator
10 |1000 characters needed characters left characters exceeded

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

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

You've provided limited information about your k8s cluster but my guess is that the pods are not fully operational (failed to start successfully).

You can check the status of your pods by running the following command:

$ kubectl -n cass-operator get pods

Here is an example output for a 3-pod cluster:

$ kubectl -n cass-operator get pods
NAME                             READY   STATUS    RESTARTS   AGE
cass-operator-56fcb9ff47-kb9lf   1/1     Running   0          6d15h
cluster1-dc1-default-sts-0       2/2     Running   0          6d15h
cluster1-dc1-default-sts-1       2/2     Running   0          6d15h
cluster1-dc1-default-sts-2       2/2     Running   0          6d15h

Note that if the value in the READY column is set to 1/2, it means that the Cassandra instance in that pod has not started successfully (for whatever reason).

If the C* instances have not started in the pod or if you ran into issues installing the cass-operator, you will not be able to connect to the Cassandra cluster via cqlsh.

If you want to start over, you can delete your KiND cluster with the following command:

$ kind delete cluster --name kind-cassandra

For more info on deleting a KiND cluster or other basic Kubernetes commands, see the KiND Quick Start guide. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

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