Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

jilani.pasha_90275 avatar image
jilani.pasha_90275 asked ·

Why can't I connect to any nodes with cqlsh?

4 Nodes created in AWS

One of the installed opscenter

Installed cluster with 3 nodes Successfully

Issue : Unable to connect to cqlsh for any of the node

Observation : Multi pythons 2.7.x and 3.x ..

socket.gaierror: [Errno 8] nodename nor servname provided, or not known
# cqlsh -u cassandra -p datastax 'hostname -i';
Traceback (most recent call last):

 File "/usr/local/bin/cqlsh", line 2816, in <module>
 main(*read_options(sys.argv[1:], os.environ))
 File "/usr/local/bin/cqlsh", line 2795, in main
 encoding=options.encoding)
 File "/usr/local/bin/cqlsh", line 690, in __init__
 load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]),
 File "/Library/Python/2.7/site-packages/cassandra/policies.py", line 426, in __init__
 for endpoint in socket.getaddrinfo(a, None, socket.AF_UNSPEC, socket.SOCK_STREAM)]

socket.gaierror: [Errno 8] nodename nor servname provided, or not known
# nodetool status
Datacenter: DC1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving/Stopped
-- Address Load Tokens Owns (effective) Host ID Rack
UN host1 220.64 KiB 1 66.7% rack1
UN host2 215.88 KiB 1 66.7% rack1
UN host3 219.76 KiB 1 66.7% rack1

syslog:

INFO [NodeSyncMaintenanceTasks:1] 2020-06-07 20:29:06,629 NodeSyncMaintenanceTasks.java:172 - In last 10m: validated 4.7MB (8kB/s), 0% was inconsistent. 
INFO [CoreThread-0] 2020-06-07 20:33:48,279 InboundMessageHandler.java:151 - Switching inbound connection from /172.31.65.110 to handle large messages...
INFO [NodeSyncMaintenanceTasks:1] 2020-06-07 20:39:06,629 NodeSyncMaintenanceTasks.java:172 - In last 10m: validated 4.5MB (7.7kB/s), 0% was inconsistent.
INFO [NodeSyncMaintenanceTasks:1] 2020-06-07 20:49:06,629 NodeSyncMaintenanceTasks.java:172 - In last 10m: validated 1.9MB (3.2kB/s), 0% was inconsistent.
cassandra
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.

bettina.swynnerton avatar image
bettina.swynnerton answered ·

Hi,

[Errno 8] nodename nor servname provided, or not known indicates that cqlsh is not able to resolve the hostname.

Try specifying the hostname explicitly. The command syntax with 'hostname -i' is incorrect.

Let us know if this works.

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.

I was correct hostname but along with ' , removed " ' " and it worked .

0 Likes 0 ·

You are completely right, it was a matter of using the right type of quotes. Thank you!

0 Likes 0 ·
smadhavan avatar image
smadhavan answered ·

@jilani.pasha_90275, in addition to explicitly specifying the hostname as @bettina.swynnerton mentioned, you could alternatively specify as cqlsh `hostname -i` -u cassandra -p REDACTED ---debug (notice the backtick symbol used as opposed to the single host).

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.