question

kimseng avatar image
kimseng asked Erick Ramirez answered

Why can't I connect to node1 with nodetool in the DS201 VM exercises?

When i am doing the exercise 09 on vnodes, I encounter this problem of one node is able to connect by the other node is unable to connect. Here are the screenshots.

1622537009060.png

1622537026597.png

At first, I have stop the 2 nodes which I have created on 07 exercises on Rings

/home/ubuntu/node1/resources/cassandra/bin/nodetool stopdaemon /home/ubuntu/node2/resources/cassandra/bin/nodetool stopdaemon

1622537151742.png then i remove the directory for both nodes using the commands

rm -rf /home/ubuntu/node1/data/

rm -rf /home/ubuntu/node2/data/

1622537309483.png

1622537332647.png

Then i edit the cassandra.yaml on 2 nodes using vi editor.

Node 1 below

1622537361771.png

Node 2 below

1622537404219.png

Then i restart the 2 nodes using dse cassandra

1622537455977.png


1622537470677.png

When i run the command

/home/ubuntu/node1/resources/cassandra/bin/nodetool status

I have only one node working

1622537026597.png

while the other node, refuse to connect.

1622537009060.png

Can you all enlightened me what have I done wrong in the steps???

ds201
1622537009060.png (45.8 KiB)
1622537026597.png (40.0 KiB)
1622537151742.png (47.7 KiB)
1622537248318.png (15.9 KiB)
1622537309483.png (33.5 KiB)
1622537332647.png (27.5 KiB)
1622537361771.png (294.6 KiB)
1622537404219.png (275.2 KiB)
1622537455977.png (14.0 KiB)
1622537470677.png (13.1 KiB)
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

This error indicates that the Cassandra process isn't running because it's not listening for connections on port 7299:

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

You can confirm this by running either the Linux netstat or lsof utilities.

Here is an example netstat output from my VM:

$ sudo netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:41962         0.0.0.0:*               LISTEN      3943/java       
tcp        0      0 127.0.0.1:9041          0.0.0.0:*               LISTEN      3226/java       
tcp        0      0 127.0.0.1:9042          0.0.0.0:*               LISTEN      3943/java       
tcp        0      0 127.0.0.1:42069         0.0.0.0:*               LISTEN      3226/java       
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1597/sshd       
tcp        0      0 127.0.0.2:7000          0.0.0.0:*               LISTEN      3943/java       
tcp        0      0 127.0.0.1:7000          0.0.0.0:*               LISTEN      3226/java       
tcp        0      0 0.0.0.0:7199            0.0.0.0:*               LISTEN      3226/java       
tcp        0      0 127.0.0.2:8609          0.0.0.0:*               LISTEN      3943/java       
tcp        0      0 127.0.0.1:8609          0.0.0.0:*               LISTEN      3226/java       
tcp        0      0 0.0.0.0:7299            0.0.0.0:*               LISTEN      3943/java       
tcp6       0      0 :::22                   :::*                    LISTEN      1597/sshd

The relevant entry is:

tcp        0      0 0.0.0.0:7299            0.0.0.0:*               LISTEN      3943/java       

Here is an example lsof output from my VM:

$ sudo lsof -nPi -sTCP:LISTEN
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd    1597   root    3u  IPv4  18060      0t0  TCP *:22 (LISTEN)
sshd    1597   root    4u  IPv6  18080      0t0  TCP *:22 (LISTEN)
java    3226 ubuntu  489u  IPv4  26420      0t0  TCP 127.0.0.1:8609 (LISTEN)
java    3226 ubuntu  491u  IPv4  26424      0t0  TCP 127.0.0.1:42069 (LISTEN)
java    3226 ubuntu  492u  IPv4  26425      0t0  TCP *:7199 (LISTEN)
java    3226 ubuntu  496u  IPv4  27658      0t0  TCP 127.0.0.1:9041 (LISTEN)
java    3226 ubuntu  500u  IPv4  26934      0t0  TCP 127.0.0.1:7000 (LISTEN)
java    3943 ubuntu  489u  IPv4  35534      0t0  TCP 127.0.0.2:8609 (LISTEN)
java    3943 ubuntu  491u  IPv4  35540      0t0  TCP 127.0.0.1:41962 (LISTEN)
java    3943 ubuntu  492u  IPv4  35543      0t0  TCP *:7299 (LISTEN)
java    3943 ubuntu  500u  IPv4  36111      0t0  TCP 127.0.0.2:7000 (LISTEN)
java    3943 ubuntu  507u  IPv4  36874      0t0  TCP 127.0.0.1:9042 (LISTEN)

Again, the relevant entry is:

java    3943 ubuntu  492u  IPv4  35543      0t0  TCP *:7299 (LISTEN)

If you can't see those entries, it means that the Cassandra process is not running which is why you can't run nodetool commands.

Review the Cassandra logs for clues as to why it had issues starting up. Cheers!

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.