DBeaver(3.8.5) unable to connect to Cassandra 2.1.2 (NoHostAvailableException) - cassandra

My DBeaver Enterprise Edition is unable to connect to a remote Cassandra store (2.1.2) on a Unix machine in the same network.It's throwing a NoHostAvailableException- All host(s) tried for query failed. The firewall is down on the Unix machine,the tcp port in cassandra.yaml is 9042 & I am using the same port in the DBeaver Connection configuration. I am also using SSH tunnel in the configuration to connect to the Unix machine.
I could use some help on fixing this problem.

Related

Not able to run Cassandra locally using brew

I am trying to run Cassandra on my machine. Tying cqlsh gives me this error,
Connection error: ('Unable to connect to any servers', {'127.0.0.1:9042': error(61, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})
Running cassandra -f hangs.
I installed cassandra using brew install cassandra.
Also I have done all of the followings:
Killed docker instance
Uninstall and reinstall Cassandra (deleted all the Cassandra data and filles from my machine)
Restarted my machine
Purged docker data
I don't know why still I am running into this. Running brew services list shows:
Name Status User Plist
cassandra started aanish /Users/aanish/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
mysql stopped
mysql#5.7 started aanish /Users/aanish/Library/LaunchAgents/homebrew.mxcl.mysql#5.7.plist
postgresql stopped
The cqlsh connection error indicates that localhost is not listening on port 9042 (Cassandra's CQL client port). The most likely reason is that the Cassandra process is not running.
You can confirm whether the Java process is listening on port 9042 if you run the following command in a terminal:
$ sudo lsof -nPi -sTCP:LISTEN
You will need to review the system.log (typically in /var/log/cassandra) to figure out what is going on with Cassandra.
Note that if you set rpc_address in cassandra.yaml to the IP of your mac, you need to specify that address when you connect with cqlsh. For example:
$ cqlsh 10.1.2.3

Connecting to cqlsh from remote fails, where as from localhost it connects?

Installed DSE on CentOS7 and saw no errors, I'm able to connect to cqlsh from the local machine and and I'm able to also do a telnet on the port.
However the problem is that when the same is done from a remote machine I get the below error
cqlsh XX.XXX.XX.XX 3389
Connection error: ('Unable to connect to any servers', {'10.223.61.49': ConnectionShutdown('Connection to 10.223.61.49 was closed',)})
To check the connectivity I did a telnet on this and see the below error
telnet XX.XXX.XX.XX 3389
Invalid or unsupported protocol version (13); supported versions are (3/v3, 4/v4, 5/v5-beta, 65/dse-v1)
I tried updating the Python version, also few tweaks to change the py script also didn't help

Unable to establish connection, All host(s) tried for query failed

i know this may be basic problem but as i am new to cassandra and did not find solution of it anywhere so When i am trying to make connection in DataStax Dev Center to cassandra server, it is giving me below exception.
Below is system configuration:
Operating System: Windows 10 pro(64- Bit)
apache-cassandra-3.11.2
Below is cassandra.yaml configuration:
start_native_transport: true
broadcast_rpc_address: 1.2.3.4
native_transport_port_ssl: 9142
listen_address: 192.168.2.22
rpc_address: 192.x.x.x
I have done these changes in cassandra.yaml file: start_rpc: true rpc_port: 9042
when running this command on cmd: nodetool -h localhost -p 9042 status
getting this error: Failed to connect to 'localhost:9042' - ConnectIOException: 'non-JRMP server at remote endpoint'.
Any help would be appreciated.
Seems like you have configured native-transport-port as :9142, but you are trying to connect to 9042 port with dev center. Please correct it and verify.
You have set rpc (rpc_port) to use the the same port as cql (native_transport_port). Are you sure you want to use rpc? This is the old deprecated interface and should not be used unless you need it for backwards compatibility.
If you actually do want to use rpc then it has to be another port than native_transport_port.
You should use jmx port (7199 default) for nodetool
I have found answer of this question and below are configurations which need to configure once you install Cassandra for first time:
broadcast_rpc_address: 192.168.2.22(ip address of system on which Cassandra is installed
rpc_address: 0.0.0.0

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).

How to configure cassandra for remote connection

I am trying to configure Cassandra Datastax Community Edition for remote connection on windows,
Cassandra Server is installed on a Windows 7 PC, With the local CQLSH it connects perfectly to the local server.
But when i try to connect with CQLSH from another PC in the same Network, i get this error message:
Connection error: ('Unable to connect to any servers', {'MYHOST':
error(10061, "Tried connecting to [('HOST_IP', 9042)]. Last error: No
connection could be made because the target machine actively refused
it")})
So i am wondering how to configure correctly (what changes should i make on cassandra.yaml config file) the Cassandra server to allow remote connections.
Thank you in advance!
How about this:
Make these changes in the cassandra.yaml config file:
start_rpc: true
rpc_address: 0.0.0.0
broadcast_rpc_address: [node-ip]
listen_address: [node-ip]
seed_provider:
- class_name: ...
- seeds: "[node-ip]"
reference: https://gist.github.com/andykuszyk/7644f334586e8ce29eaf8b93ec6418c4
Remote access to Cassandra is via its thrift port for Cassandra 2.0. In Cassandra 2.0.x, the default cqlsh listen port is 9160 which is defined in cassandra.yaml by the rpc_port parameter. By default, Cassandra 2.0.x and earlier enables Thrift by configuring start_rpc to true in the cassandra.yaml file.
In Cassandra 2.1, the cqlsh utility uses the native protocol. In Cassandra 2.1, which uses the Datastax python driver, the default cqlsh listen port is 9042.
The cassandra node should be bound to the IP address of your server's network card - it shouldn't be 127.0.0.1 or localhost which is the loopback interface's IP, binding to this will prevent direct remote access. To configure the bound address, use the rpc_address parameter in cassandra.yaml. Setting this to 0.0.0.0 will listen on all network interfaces.
Have you checked that the remote machine can connect to the Cassandra node? Is there a firewall between the machines? You can try these steps to test this out:
1) Ensure you can connect to that IP from the server you are on:
$ ssh user#xxx.xxx.xx.xx
2) Check the node's status and also confirm it shows the same IP:
$nodetool status
3) Run the command to connect with the IP (only specify the port if you are not using the default):
$ cqlsh xxx.xxx.xx.xx
Alternate solution to Kat. Worked with Ubuntu 16.04
ssh into server server_user#**.**.**.**
Stop cassandra if running:
Check if running with ps aux | grep cassandra
If running, will output a large block of commands / flags, e.g.
ubuntu 14018 4.6 70.1 2335692 712080 pts/2 Sl+ 04:15 0:11 java -Xloggc:./../logs/gc.log ........
Note 14018 in the example is the process id
Stop with kill <process_id> (in this case 14018)
edit cassandra.yaml file to be the following
rpc_address: 0.0.0.0
broadcast_rpc_address: **.**.**.** <- your server's IP (cannot be set to 0.0.0.0)
Restart cassandra ./bin/cassandra -f (from within cassandra root)
Open another terminal on local machine & connect via cqlsh **.**.**.** (your server's IP) to test.
The ./bin/nodetool status address reported my localhost IP (127.0.0.1), but cqlsh remotely still worked despite that.

Resources