Logs are confusing because compression is enabled by default but if user doesn't have a compression library installed it shows up as ERROR in the logs but technically it's just a warning.
Example:
import logging
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(name)s: %(message)s")
from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster, ExecutionProfile, EXEC_PROFILE_DEFAULT
from cassandra.policies import DCAwareRoundRobinPolicy
profile = ExecutionProfile(load_balancing_policy=DCAwareRoundRobinPolicy(local_dc=DATACENTER))
auth = PlainTextAuthProvider(username=USERNAME, password=PASSWORD)
print("Connecting WITH datacenter / DC-aware policy...")
cluster = Cluster(
contact_points=[CONTACT_POINT],
port=PORT,
auth_provider=auth,
execution_profiles={EXEC_PROFILE_DEFAULT: profile},
)
try:
session = cluster.connect()
except Exception as e:
print(f"Connection failed: {e}")
finally:
cluster.shutdown()
Output:
Connecting WITH datacenter / DC-aware policy...
ERROR cassandra.cluster: Compression is enabled, but no compression libraries are available. Disabling compression, consider installing one of the Python packages: lz4 and/or python-snappy.
WARNING cassandra.cluster: Downgrading core protocol version from 5 to 4 for <IP>:9042. To avoid this, it is best practice to explicitly set Cluster(protocol_version) to the version supported by your cluster. http://datastax.github.io/python-driver/api/cassandra/cluster.html#cassandra.cluster.Cluster.protocol_version
INFO cassandra.cluster: New Cassandra host <Host: <IP>:9042 AWS_US_EAST_1> discovered
INFO cassandra.cluster: New Cassandra host <Host:<IP>:9042 AWS_US_EAST_1> discovered
INFO cassandra.cluster: New Cassandra host <Host: <IP>:9042 AWS_US_EAST_1> discovered
Logs are confusing because compression is enabled by default but if user doesn't have a compression library installed it shows up as
ERRORin the logs but technically it's just a warning.Example:
Output: