PLANNED MAINTENANCE

Hello, DataStax Community!

We want to make you aware of a few operational updates which will be carried out on the site. We are working hard to streamline the login process to integrate with other DataStax resources. As such, you will soon be prompted to update your password. Please note that your username will remain the same.

As we work to improve your user experience, please be aware that login to the DataStax Community will be unavailable for a few hours on:

  • Wednesday, July 15 16:00 PDT | 19:00 EDT | 20:00 BRT
  • Thursday, July 16 00:00 BST | 01:00 CEST | 04:30 IST | 07:00 CST | 09:00 AEST

For more info, check out the FAQ page. Thank you for being a valued member of our community.


question

sibi.revi_190654 avatar image
sibi.revi_190654 asked ·

Why can't I connect with cqlsh to node 3 in exercise 14 of the Academy DS201 course?

I have 3 nodes. As per lab instructions the first two nodes have to be brought down. Now in node 3 i am unable to connect to cqlsh. It keeps throwing error. I have tried providing the explicit ip and port as mentioned in an earlier lab. Please let know how to we connect to db from node 3.

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

What error are you getting?

0 Likes 0 · ·
sibi.revi_190654 avatar image sibi.revi_190654 bettina.swynnerton ♦♦ ·

Connection error: ('Unable to connect to any servers', {'127.0.0.3': error(111, "Tried connecting to [('127.0.0.3', 9043)]. Last error: Connection refused")})

0 Likes 0 · ·

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

I suspect the problem you're encountering is similar to Why can't I connect to nodes in the DS201 Academy VM with cqlsh or nodetool?.

CQL clients configuration

cqlsh by default connects to CQL port 9042 but because all DSE instances are running in the same VM, they have to be configured to listen to different ports. The nodes in the DS201 VM are configured as follows:

$ for _node in node*; do echo "$_node - `grep ^native_transport_port $_node/resources/cassandra/conf/cassandra.yaml`"; done
node1 - native_transport_port: 9041
node2 - native_transport_port: 9042
node3 - native_transport_port: 9043

However, all the 3 ports are bound to 127.0.0.1:

$ for _node in node*; do echo "$_node - `grep ^native_transport_address $_node/resources/cassandra/conf/cassandra.yaml`"; done
node1 - native_transport_address: localhost
node2 - native_transport_address: localhost
node3 - native_transport_address: localhost

Sample VM

When I check on my copy of the VM, I can confirm that CQL clients (cqlsh is just another client) can only connect on localhost:

$ sudo lsof -nPi | grep LISTEN | grep 904
java      1544 ubuntu  481u  IPv4  19709      0t0  TCP 127.0.0.1:9041 (LISTEN)
java      2135 ubuntu  485u  IPv4  24848      0t0  TCP 127.0.0.1:9042 (LISTEN)
java     18820 ubuntu  480u  IPv4  45516      0t0  TCP 127.0.0.1:9043 (LISTEN)

This means that you won't be able to connect to any IP other than 127.0.0.1.

Solution

In order to connect to node 3, run cqlsh with the following parameters:

$ cqlsh 127.0.0.1 9043

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.