DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

krishnamohan100_189669 avatar image
krishnamohan100_189669 asked ·

Why can't I connect to nodes in the DS201 Academy VM with cqlsh or nodetool?

I am currently working on the hinted handoff exercise in DS201. As mentioned in the exercise steps, I have shut downed my nodes 1 & 2. When I try to start cqlsh using node 3 , it is throwing the error " Unable to connect to cqlsh,"Tried connecting to[('127.0.0.1',9042)]. Last error: Connection Refused".

My node details are as below.

2 DCs : east-side, west-side

1 Rack: hakuna-matata

3 Nodes: east-side: 127.0.02; west-side: 127.0.0.1, 127.0.0.3.

I used the nodetool stopdaemon command on 127.0.0.1 and 127.0.0.2.

Following that I tried to invoke CQLSH from Node 3 - 127.0.0.3 but I get the above mentioned error. I also tried to pass the ip address to Cqlsh like $ CQLSH 127.0.0.3 but still no luck. What could be the reason? How to resolve this?

academyds201
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 ·

@krishnamohan100_189669 The problem you described here is similar to the problem in Using the VM image in DS201, why did I lose node1 when I decommissioned node3?. The issue is that the DSE instances are not running/listening on the standard ports because they are have been configured differently so they could run on one server.

CQL configuration

cqlsh connects to the default CQL port 9042 but the nodes are configured to listen on different ports in cassandra.yaml:

node1 - native_transport_port: 9041
node2 - native_transport_port: 9042
node3 - native_transport_port: 9043

In my VM instance, netstat shows that the DSE instances are all listening on localhost (127.0.0.1) but on different ports:

$ netstat -tnlp | grep 904
tcp        0      0 127.0.0.1:9041          0.0.0.0:*               LISTEN      1571/java       
tcp        0      0 127.0.0.1:9042          0.0.0.0:*               LISTEN      2139/java       
tcp        0      0 127.0.0.1:9043          0.0.0.0:*               LISTEN      3015/java

This means that if you want to connect to node3 with cqlsh, you need to specify both the IP address and CQL port:

$ cqlsh 127.0.0.1 9043

JMX configuration

Similarly, JMX is configured to listen on different ports in cassandra-env.sh:

node1 - JMX_PORT="7199"
node2 - JMX_PORT="7299"
node3 - JMX_PORT="7399"

To execute a nodetool command against node3, you need to specify the node's JMX port:

$ nodetool -p 7399 <command>

For more info, see the cqlsh startup options page. Cheers!

2 comments 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.

Thank you Erick!

As I understand, Exercise for Consistency in DS6 201 course will require replacement

of nodeX/bin/cqlsh 127.0.0.X 904X

to nodeX/bin/cqlsh 127.0.0.1 904X

to avoid confusion in learners.

0 Likes 0 · ·

Not quite. If you check the lsof output I posted, you'll see that the nodes are all configured to use localhost (127.0.0.1) so only the port numbers differ. Cheers!

0 Likes 0 · ·