com.datastax.spark.connector.cql
Configured authentication options
Automatically closes resource after use.
Automatically closes resource after use. Handy for closing streams, files, sessions etc. Similar to try-with-resources in Java 7.
Returns the local node, if it is one of the cluster nodes.
Returns the local node, if it is one of the cluster nodes. Otherwise returns any node.
Connection configurator
Known cluster hosts in the connected datacenter.
Allows use of a Cassandra Session in a safe way without
risk of forgetting to close it from java.
Allows use of a Cassandra Session in a safe way without
risk of forgetting to close it from java. See withSessionDo
We should not need this in scala 2.12
Returns a shared session to Cassandra and increases the internal open reference counter.
Returns a shared session to Cassandra and increases the internal open reference counter. It does not release the session automatically, so please remember to close it after use. Closing a shared session decreases the session reference counter. If the reference count drops to zero, the session may be physically closed.
Configured native port
Allows to use Cassandra Cluster in a safe way without
risk of forgetting to close it.
Allows to use Cassandra Cluster in a safe way without
risk of forgetting to close it. Multiple, concurrent calls might share the same
Cluster. The Cluster will be closed when not in use for some time.
It is not recommended to obtain sessions from this method. Use withSessionDo
instead which allows for proper session sharing.
Allows to use Cassandra Session in a safe way without
risk of forgetting to close it.
Allows to use Cassandra Session in a safe way without
risk of forgetting to close it. The Session object obtained through this method
is a proxy to a shared, single Session associated with the cluster.
Internally, the shared underlying Session will be closed shortly after all the proxies
are closed.
Provides and manages connections to Cassandra.
A
CassandraConnectorinstance is serializable and can be safely sent over network, because it automatically reestablishes the connection to the same cluster after deserialization. Internally it saves a list of all nodes in the cluster, so a connection can be established even if the host given in the initial config is down.Multiple
CassandraConnectors in the same JVM connected to the same Cassandra cluster will share a single underlyingClusterobject.CassandraConnectorwill close the underlyingClusterobject automatically whenever it is not used i.e. noSessionorClusteris open for longer thanspark.cassandra.connection.keepAliveMSproperty value.A
CassandraConnectorobject is configured from CassandraConnectorConf object which can be either given explicitly or automatically configured from SparkConf. The connection options are:spark.cassandra.connection.host: contact points to connect to the Cassandra cluster, defaults to spark master hostspark.cassandra.connection.port: Cassandra native port, defaults to 9042spark.cassandra.connection.factory: name of a Scala module or class implementing CassandraConnectionFactory that allows to plugin custom code for connecting to Cassandraspark.cassandra.connection.keepAliveMS: how long to keep unused connection before closing it (default 250 ms)spark.cassandra.connection.timeoutMS: how long to wait for connection to the Cassandra cluster (default 5 s)spark.cassandra.connection.reconnectionDelayMS.min: initial delay determining how often to try to reconnect to a dead node (default 1 s)spark.cassandra.connection.reconnectionDelayMS.max: final delay determining how often to try to reconnect to a dead node (default 60 s)spark.cassandra.auth.username: login for password authenticationspark.cassandra.auth.password: password for password authenticationspark.cassandra.auth.conf.factory: name of a Scala module or class implementing AuthConfFactory that allows to plugin custom authentication configurationspark.cassandra.query.retry.count: how many times to reattempt a failed query (default 10)spark.cassandra.read.timeoutMS: maximum period of time to wait for a read to returnspark.cassandra.connection.ssl.enabled: enable secure connection to Cassandra clusterspark.cassandra.connection.ssl.trustStore.path: path for the trust store being usedspark.cassandra.connection.ssl.trustStore.password: trust store passwordspark.cassandra.connection.ssl.trustStore.type: trust store type (default JKS)spark.cassandra.connection.ssl.protocol: SSL protocol (default TLS)spark.cassandra.connection.ssl.enabledAlgorithms: SSL cipher suites (default TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA)