Authentication configuration
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.
Opens a Thrift client to the given host.
Opens a Thrift client to the given host. Don't use it unless you really know what you are doing.
Known cluster hosts.
Known cluster hosts. This is going to return all cluster hosts after at least one successful connection has been made
Configured native port
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 thrift client 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.
(cassandraConnector: StringAdd).self
(cassandraConnector: StringFormat).self
(cassandraConnector: ArrowAssoc[CassandraConnector]).x
(Since version 2.10.0) Use leftOfArrow instead
(cassandraConnector: Ensuring[CassandraConnector]).x
(Since version 2.10.0) Use resultOfEnsuring instead
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.keep_alive_msproperty value.A
CassandraConnectorobject is configured from CassandraConnectorConf object which can be either given explicitly or automatically configured fromSparkConf. The connection options are:spark.cassandra.connection.host: contact point to connect to the Cassandra cluster, defaults to spark master hostspark.cassandra.connection.rpc.port: Cassandra thrift port, defaults to 9160spark.cassandra.connection.native.port: Cassandra native port, defaults to 9042spark.cassandra.auth.username: login for password authenticationspark.cassandra.auth.password: password for password authenticationspark.cassandra.auth.conf.factory.class: name of the class implementing AuthConfFactory that allows to plugin custom authenticationAdditionally this object uses the following global System properties:
spark.cassandra.connection.keep_alive_ms: the number of milliseconds to keep unusedClusterobject before destroying it (default 100 ms)spark.cassandra.connection.reconnection_delay_ms.min: initial delay determining how often to try to reconnect to a dead node (default 1 s)spark.cassandra.connection.reconnection_delay_ms.max: final delay determining how often to try to reconnect to a dead node (default 60 s)spark.cassandra.query.retry.count: how many times to reattempt a failed query