krishnamohan100_189669 avatar image
krishnamohan100_189669 asked Erick Ramirez edited

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[('',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:,

I used the nodetool stopdaemon command on and

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

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

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez edited

@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 ( but on different ports:

$ netstat -tnlp | grep 904
tcp        0      0*               LISTEN      1571/java       
tcp        0      0*               LISTEN      2139/java       
tcp        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 9043

JMX configuration

Similarly, JMX is configured to listen on different ports in

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

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

malikpunit_151824 avatar image malikpunit_151824 commented ·

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 904X

to avoid confusion in learners.

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ malikpunit_151824 commented ·

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

0 Likes 0 ·