Cloud
Connecting
To connect to a DataStax Apollo cluster:
-
Download the secure connect bundle from your Apollo account.
-
Connect to your cluster with
from dse.cluster import Cluster
from dse.auth import PlainTextAuthProvider
cloud_config = {
'secure_connect_bundle': '/path/to/secure-connect-dbname.zip'
}
auth_provider = PlainTextAuthProvider(username='user', password='pass')
cluster = Cluster(cloud=cloud_config, auth_provider=auth_provider)
session = cluster.connect()
Apollo Differences
In most circumstances, the client code for interacting with an Apollo cluster will be the same as interacting with any other Cassandra cluster. The exceptions being:
-
A cloud configuration must be passed to a
Cluster
instance via the cloud attribute (as demonstrated above). -
An SSL connection will be established automatically. Manual SSL configuration is not allowed, and using ssl_context or ssl_options will result in an exception.
-
A
Cluster
’s contact_points attribute should not be used. The cloud config contains all of the necessary contact information. -
If a consistency level is not specified for an execution profile or query, then
ConsistencyLevel.LOCAL_QUORUM
will be used as the default.
Limitations
Event loops
Twisted and Evenlet aren’t supported yet. These event loops are still using the old way to configure SSL (ssl_options), which is not compatible with the secure connect bundle provided by Apollo.