Apache Cassandra Connection¶
The Apache Cassandra connection type enables connection to Apache Cassandra.
Default Connection IDs¶
Cassandra hook and Cassandra operators use cassandra_default
by default.
Configuring the Connection¶
- Host (required)
The host to connect to. It is possible to specify multiple hosts as a comma-separated list.
- Schema (required)
The schema (keyspace) name to be used in the database.
- Login (required)
The user name to connect.
- Password (required)
The password to connect.
- Port (required)
The port to connect.
- Extra (optional)
The extra parameters (as json dictionary) that can be used in cassandra connection. The following parameters out of the standard python parameters are supported:
load_balancing_policy
- This parameter specifies the load balancing policy to be used. There are four available policies:RoundRobinPolicy
,DCAwareRoundRobinPolicy
,WhiteListRoundRobinPolicy
andTokenAwarePolicy
.RoundRobinPolicy
is the default load balancing policy.load_balancing_policy_args
- This parameter specifies the arguments for the load balancing policy being used.cql_version
- This parameter specifies the CQL version of cassandra.protocol_version
- This parameter specifies the maximum version of the native protocol to use.ssl_options
- This parameter specifies the details related to SSL, if it’s enabled in Cassandra.
Examples for the Extra field¶
Specifying
ssl_options
If SSL is enabled in Cassandra, pass in a dict in the extra field as kwargs for ssl.wrap_socket()
. For example:
{
"ssl_options": {
"ca_certs": "PATH/TO/CA_CERTS"
}
}
Specifying
load_balancing_policy
andload_balancing_policy_args
Default load balancing policy is RoundRobinPolicy
. Following are a few samples to specify a different LB policy:
DCAwareRoundRobinPolicy:
{
"load_balancing_policy": "DCAwareRoundRobinPolicy",
"load_balancing_policy_args": {
"local_dc": "LOCAL_DC_NAME",
"used_hosts_per_remote_dc": "SOME_INT_VALUE"
}
}
WhiteListRoundRobinPolicy:
{
"load_balancing_policy": "WhiteListRoundRobinPolicy",
"load_balancing_policy_args": {
"hosts": ["HOST1", "HOST2", "HOST3"]
}
}
TokenAwarePolicy:
{
"load_balancing_policy": "TokenAwarePolicy",
"load_balancing_policy_args": {
"child_load_balancing_policy": "CHILD_POLICY_NAME",
"child_load_balancing_policy_args": {}
}
}