NoHostAvailable connecting to Cassandra from python in Databricks environment

268 views Asked by At
from cassandra.cluster import Cluster

hostname = ['contact_point_name']
port = '10350'
cluster = Cluster(hostname, control_connection_timeout=None, port = port)
session = cluster.connect()

Error: NoHostAvailable: ('Unable to connect to any servers', {'23.96.242.234:10350': OperationTimedOut('errors=Timed out creating connection (5 seconds), last_host=None')})

1

There are 1 answers

2
Erick Ramirez On

The error you posted indicates that it couldn't connect to the cluster at all.

The possible causes are:

  • There is no network connectivity to the node(s).
  • The node is not listening on port 10350 on IP 23.96.242.234

Cassandra is listening for client connections on IP rpc_address and port native_transport_port (default is 9042). Confirm that you have the correct details and ensure there's connectivity between your machine and the cluster using Linux tools such as telnet or nc. Cheers!