Click or drag to resize

ICluster Interface

Informations and known state of a Cassandra cluster.

This is the main entry point of the driver. A simple example of access to a Cassandra cluster would be:

 Cluster cluster = Cluster.Builder.AddContactPoint("192.168.0.1").Build(); 
             Session session = Cluster.Connect("db1"); 
             foreach (var row in session.execute("SELECT * FROM table1")) 
               //do something ... 

A cluster object maintains a permanent connection to one of the cluster node that it uses solely to maintain informations on the state and current topology of the cluster. Using the connection, the driver will discover all the nodes composing the cluster as well as new nodes joining the cluster.

Namespace:  Cassandra
Assembly:  Cassandra (in Cassandra.dll) Version: 3.11.0
Syntax
C#
public interface ICluster : IDisposable

The ICluster type exposes the following members.

Properties
  NameDescription
Public propertyConfiguration
Cluster client configuration
Public propertyMetadata
Gets read-only metadata on the connected cluster.

This includes the know nodes (with their status as seen by the driver) as well as the schema definitions.

This method may trigger the creation of a connection if none has been established yet.

Top
Methods
  NameDescription
Public methodAllHosts
Returns all known hosts of this cluster.
Public methodConnect
Creates a new session on this cluster.
Public methodConnect(String)
Creates a new session on this cluster and sets a keyspace to use.
Public methodConnectAsync
Creates a new session on this cluster.
Public methodConnectAsync(String)
Creates a new session on this cluster and using a keyspace an existing keyspace.
Public methodGetHost
Get the host instance for a given Ip address.
Public methodGetReplicas(Byte)
Gets a collection of replicas for a given partitionKey. Backward-compatibility only, use GetReplicas(keyspace, partitionKey) instead.
Public methodGetReplicas(String, Byte)
Gets a collection of replicas for a given partitionKey on a given keyspace
Public methodRefreshSchema
Updates keyspace metadata (including token metadata for token aware routing) for a given keyspace or a specific keyspace table. If no keyspace is provided then this method will update the metadata and token map for all the keyspaces of the cluster.
Public methodRefreshSchemaAsync
Updates keyspace metadata (including token metadata for token aware routing) for a given keyspace or a specific keyspace table. If no keyspace is provided then this method will update the metadata and token map for all the keyspaces of the cluster.
Public methodShutdown
Shutdown this cluster instance. This closes all connections from all the sessions of this * Cluster instance and reclaim all resources used by it.

This method has no effect if the cluster was already shutdown.

Public methodShutdownAsync
Shutdown this cluster instance asynchronously. This closes all connections from all the sessions of this * Cluster instance and reclaim all resources used by it.

This method has no effect if the cluster was already shutdown.

Top
Events
  NameDescription
Public eventHostAdded
Event that gets triggered when a new host is added to the cluster
Public eventHostRemoved
Event that gets triggered when a host has been removed from the cluster
Top
See Also