I've tried both with pycassa
, cassandra.cluster
and dse.cluster
without making a connection.
I feel like I'm connecting to the wrong host, as I'm writing the linux servers hostname and not specifying anything regarding the cassandra.
Collegues have told me they only know of connecting to the server through cqlsh
inline on the linux machine. That just sounds unconvinient.
Specific configurations in cassandra.yaml
authenticator: com.datastax.bdp.cassandra.auth.DseAuthenticator
authorizer: com.datastax.bdp.cassandra.auth.DseAuthorizer
What I'm doing in pycassa:
import pycassa
URIPORTLIST = ['12345.mycompany.net:9420']
pool = pycassa.ConnectionPool('my_keyspace', server_list=URIPORTLIST,credentials={'USERNAME':'fancycar','PASSWORD':'becauseimbatman'}, prefill=False)
cf = pycassa.ColumnFamily(pool, 'my_table')
Error message:
AllServersUnavailable: An attempt was made to connect to each of the servers twice, but none of the attempts succeeded. The last failure was TTransportException: Could not connect to 12345.mycompany.net:9420
With dse.cluster
from dse.cluster import Cluster
auth_provider = PlainTextAuthProvider(
username='fancycar', password='becauseimbatman')
cluster = Cluster(
['12345.mycompany.net'],
port=9042,auth_provider=auth_provider)
session = cluster.connect('my_keyspace')
Error message:
NoHostAvailable: ('Unable to connect to any servers', {'11.111.11.1': AuthenticationFailed('Failed to authenticate to 11.111.11.2: Error from server: code=0100 [Bad credentials] message="Failed to login. Please re-try."',)})
Fastest way to read Cassandra data into pandas with automatic iteration of pages. Create dictionary and add each to it by automatically iterating all pages. Then, create dataframe with this dictionary. Show activity on this post.
Fixed by using the dse.auth PlainTextAuthProvider instead of the Cassandra one..
from dse.cluster import Cluster
# pip install dse-driver
from dse.auth import PlainTextAuthProvider
auth_provider = PlainTextAuthProvider(
username='fancycar', password='becauseimbatman ')
cluster = Cluster(contact_points=['12345.mycompany.net'],
port=9042, auth_provider=auth_provider)
session = cluster.connect('batcave')
print "connected"
print session.execute("SELECT * FROM robinstears")[0]
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