riptano / ccm

A script to easily create and destroy an Apache Cassandra cluster on localhost
Apache License 2.0
1.21k stars 299 forks source link

Cannot authenticate to basic cluster #765

Open boonware opened 2 months ago

boonware commented 2 months ago

I have created a cluster using the following: ccm create --pwd-auth test --version 4.1.4 --nodes 1 --debug --start

When I try to connect in a Python integration test using the Cassandra default username and password (cassandra/cassandra), I receive the error:

cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'127.0.0.1:9042': AuthenticationFailed('Failed to authenticate to 127.0.0.1:9042: Error from server: code=0100 [Bad credentials] message="Provided username cassandra and/or password are incorrect"')})

My connection code is as follows:

from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
from cassandra.policies import DCAwareRoundRobinPolicy

config = {'cassandra': {'hosts': ['127.0.0.1'], 'username': 'cassandra', 'password': 'cassandra', 'keyspace': 'myKeyspace'}}
cluster = Cluster(hosts, auth_provider=PlainTextAuthProvider(username=config['username'], password=config['password']),
            load_balancing_policy=DCAwareRoundRobinPolicy())
session = cluster.connect(config['keyspace'])

What are the default credentials? How am I supposed to authenticate to the cluster?