Not able to login to cqlsh in Cassandra cluster of 3 nodes hosted in Google cloud platform - cassandra

I'm setting up a 3 node Cassandra cluster and after installing
cassandra I tried to connect to cassandra using 'cqlsh'
I'm not able to connect to cassandra db terminal.
rammady#deb-cassandra-ram-1:~$ cqlsh 10.142.0.76 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've modified cassandra.yaml file and provided 1: private ip address
under seed -seed:10.142.0.75,10.142.0.76,10.142.0.77 2:
listen_address: 10.142.0.75 3: rpc_address: 10.142.0.75

You need to connect to the ip you defined in the config:
cqlsh 10.142.0.75
netstat -tulpn would show you, that the node is listening not on the loopback if.

Related

unable to access CQLSH from .cmd locally on VM

I am trying to connect with my Cassandra DB resides in a Windows VM but while executing the command cqlsh on Local command window. I am getting an exception:
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(10061, "Tried connecting to [('127.0.0.1', 9042)]. Last error: No connection could be made because the target machine actively refused it")})
I'm able to connect this cassandra cluster from my cloud platform 'Databricks' with it's public ip using Spark but on local system it is throwing the error.
Can anyone please help me on this?
in Cassandra configs, Check on which ip address you've bind your rpc calls to ?
if it's not localhost/127.0.0.1 then specify on which interface's ip you've bind it to..
then connect with specifying ip address -
cqlsh <ip address for rpcs calls>

accessing remote cassandra database

I am trying to access remote cassendra database by command:
cqlsh xx:x:x:x xxxx
got below error:
Connection error:
('Unable to connect to any servers',
{'xx:x:x:x': ConnectionShutdown('Connection to xx:x:x:x was closed',)
}
)
when I am trying to access localhost I am getting error:
command: cqlsh
error:
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")}
)
You need to check that Cassandra is accessible on the given IP & port that you specify in the command line. If you didn't change default ports, then you can use cqlsh IP. If it doesn't work, check that you don't have firewall that doesn't allow traffic to port 9042 on given IP.

CQLSH is not recognized in google cloud datastax cluster nodes

I have deployed a 4 node datastax cluster in GCP. I can ssh into each of the VM nodes but cqlsh is not recognized.Can you please help me to understand where I am going wrong
error:
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")})
If your cluster is working correctly, then the nodes must know about each other by their own IPs (internal or external). So Cassandra isn't configured to bind 9042 to 127.0.0.1, which means trying to cqlsh to 127.0.0.1:9042 won't work.
One way to check, would be just to do a nodetool status, and use one of those IP addresses. But, as you're on GCP, you may have both internal and external IP addresses, so in that case it really depends on which IP is set as your broadcast_rpc_address. You can check them all by grepping your cassandra.yaml.
$ grep "_address:" cassandra.yaml
listen_address: 192.168.1.3
broadcast_address: 10.20.15.1
# listen_on_broadcast_address: false
rpc_address: 192.168.1.3
broadcast_rpc_address: 10.20.15.1
In this case, your cqlsh command would look something like this:
cqlsh 10.20.15.1 -u youruser -p yourpassword

Cant' connect to Cassandra with cqlsh

When i tried to connect to my cassandra cluster with cqlsh, i had this following error :
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")})
So i go to the cassandra.yaml file but my rpc_adress and listen_address parameters are goods.
There is my listen_adress :
# ipv4. If there is only one address it will be selected regardless of ipv4/ipv6.
listen_address: localhost
# listen_interface: eth0
# listen_interface_prefer_ipv6: false
And my rpc_address :
rpc_address: localhost
# port for Thrift to listen for clients on
rpc_port: 9160
I also tried to modify the file, but i dont have the right for it.
Thank you in advance

Cassandra Cqlsh is not working

I've just started working with Cassandra (homebrew install), version 3.7 and cqlsh version 5.0.1. , OS X El Capitan
Cassandra starts up fine and the cluster is operational instantly.
Cqlsh is not working (on any of the nodes) and emits the following error:
Connection error: ('Unable to connect to any servers', {'127.0.0.1':
error(61, "Tried connecting to [('127.0.0.1', 9042)]. Last error:
Connection refused")})
Edit cqlsh and change DEFAULT_HOST = IP and then run cqlsh.
I think the first step you should be doing is running netstat -ntpl. This should list down all the ports active on the system. Check for Local Address there you shall find a IP prepended with 9042.
Use this IP to connect ie cqlsh IP . If you do not find the 9042 port in the netstat output than check your cassandra.yaml file. Grep for native_transport_port see if it is 9042 or something different.
If different than connect on that port via cqlsh.
For future reference, if someone else gets it.
I'm running [cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4].
Add start_native_transport: true field in cassandra.yaml file, by default it doesn't enables it and so no rpc communication with client.
Now try connecting with cqlsh rpc_endpoint(rpc addr set in cassandra.yaml).

Resources