What might I be missing? I'm Unable to connect using python Cassandra-Driver however I seem to be able to connect fine when using the CQL module.
cluster = Cluster(
contact_points=['10.x.x.xx',],
port=9160)
session = cluster.connect()
session.set_keyspace("mykeyspace")
Output:
cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'10.0.x.xx': ConnectionShutdown('Connection to 10.0.x.xx is closed',)})
Also, I'm hosting cassandra from a virtual machine with a single node if that matters.
Python module for working with Cassandra database is called Cassandra Driver. It is also developed by Apache foundation. This module contains an ORM API, as well as a core API similar in nature to DB-API for relational databases. Installation of Cassandra driver is easily done using pip utility.
The driver supports Python 2.7, 3.4, 3.5, and 3.6.
The DataStax Python driver (which is what it looks like you are using) is using the native protocol and that uses the 9042 port by default. If you checking your conf file (cassandra.yaml
), make sure you have the start_native_transport: true
(default value since 1.2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With