Reputation: 11
Code:
ap = PlainTextAuthProvider(username='cassandra',password='cassandra')
cass_contact_points=['localhost']
cluster = Cluster(['localhost'],auth_provider=ap)
session = cluster.connect('dbsi')
Output:
Traceback (most recent call last): File "C:/Users/rvcsp/PycharmProjects/untitled25/hotel.py", line 9, in session = cluster.connect('dbsi') File "C:\Users\rvcsp\AppData\Roaming\Python\Python36\site-packages\cassandra\cluster.py", line 1270, in connect self.control_connection.connect() File "C:\Users\rvcsp\AppData\Roaming\Python\Python36\site-packages\cassandra\cluster.py", line 2773, in connect self._set_new_connection(self._reconnect_internal()) File "C:\Users\rvcsp\AppData\Roaming\Python\Python36\site-packages\cassandra\cluster.py", line 2816, in _reconnect_internal raise NoHostAvailable("Unable to connect to any servers", errors) cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'::1': ConnectionRefusedError(10061, "Tried connecting to [('::1', 9042, 0, 0)]. Last error: No connection could be made because the target machine actively refused it"), '127.0.0.1': ConnectionRefusedError(10061, "Tried connecting to [('127.0.0.1', 9042)]. Last error: No connection could be made because the target machine actively refused it")})
Upvotes: 1
Views: 906
Reputation: 87154
Check that:
localhost
& port 9042cqlsh -u cassandra -p cassandra localhost
Upvotes: 0