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

igor.rmarinho_185445 avatar image
igor.rmarinho_185445 asked ·

Unable to connect with cqlsh, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused"

Hi, I'm having this issue below, I'm using google cloud VM

$ cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

I set my hosts like this

127.0.0.1 localhost
10.14*.0.* vm-1
10.15*.0.* vm-2

I got the ip from ifconfig

vm-1 inet addr:10.14*.0.* Bcast:10.14*.0.* Mask:255.255.255.255
vm-2 inet addr:10.15*.0.* Bcast:10.15*.0.* Mask:255.255.255.255

I set in VM-2 in cassandra.yaml

listen_address: 10.15*.0.*
rpc_address: 10.15*.0.*

and in cassandra-env.sh

JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=10.15*.0.*"

I already tried everything I could But I cant fix it, please help.

cassandracqlsh
1 comment
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.

Where exactly do you run this `cqlsh` command, on one of these two VMs? Can you try to log in directly via ssh and try to execute the command? What's the `nodetool status`?

0 Likes 0 · ·
Erick Ramirez avatar image
Erick Ramirez answered ·

@igor.rmarinho_185445 The reason you can't connect to the cluster is because you haven't specified an IP address to cqlsh so it defaults to localhost (127.0.0.1).

For example, if the node's listen_address is 10.150.0.1 then the command to connect is:

$ cqlsh 10.150.0.1

For more info, see the cqlsh startup options page on the DataStax Docs site. 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.

Cedrick Lunven avatar image
Cedrick Lunven answered ·

Might be obvious but

you obfuscated the real values with * characters.

We don't use wild chars in cassandra.yaml

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.