-
Notifications
You must be signed in to change notification settings - Fork 41
Configuration
The configuration can be set in the app.config of your application. It is entirely optionnal and you can go the imperative way if you prefer.
If you decide to use a declarative configuration, don't forget the config section !
<configSections>
<section name="CassandraSharp" type="CassandraSharp.SectionHandler, CassandraSharp.Interfaces" />
</configSections>
<CassandraSharp>
<Cluster name="TestCassandra">
<Transport type="CqlBinary"
port="9042" />
<Endpoints strategy="Nearest" snitch="RackInferring">
<Server>127.0.0.1</Server>
<Server>127.0.0.2</Server>
</Endpoints>
</Cluster>
</CassandraSharp>
See below why attributes can be stripped.
<CassandraSharp>
<Cluster name="TestCassandra">
<Endpoints>
<Server>127.0.0.1</Server>
<Server>127.0.0.2</Server>
</Endpoints>
</Cluster>
</CassandraSharp>
<CassandraSharp>
<Recovery type="@recoveryType" interval="@recoveryInterval" />
<Logger type="@loggerType" />
<Instrumentation type="@instrumentationType" />
<Cluster name="@clusterName" type="@clusterType" partitioner="@clusterPartitioner">
<Endpoints snitch="@snitch" strategy="@strategy">
<Server>127.0.0.1</Server>
<Server>127.0.0.2</Server>
<Discovery type="@discoveryType" interval="@discoveryInterval" />
</Endpoints>
<Transport keepAlive="@keepAlive" keepAliveTime="@keepAliveTime"
port="@port" type="@transportType"
rcvTimeout="@rcvTimeout" sndTimeout="@sndTimeout"
recoverable="@recoverable"
user="@user" password="@password"
cqlver="@cqlver"
cl="@cl" execFlags="@execFlags" />
</Transport>
</Cluster>
</CassandraSharp>
This section declares global behavior.
This sections declares recovery configuration - you may omit this section (default applies).
@recoveryType: name of the recovery strategy (default is Simple).
- Null : use NullRecoveryService - never try to recover
- Simple: use SimpleRecoveryService - recovery happens if reconnection is successful. See EndpointRecovery
- FQCN : use class as recovery. See ExtensibilityPoints
@recoveryInterval : duration between recoveries (default is 60 seconds)
This section declares logging configuration - you may omit this section (default applies).
@loggerType : name of the logger (default is Null)
- Null : use NullLogger - nothing is logged
- FQCN : use class as logger. See ExtensibilityPoints
This section declares instrumentation configuration. This section can be omitted.
@instrumentationType : name of the instrumentation service (default is Null)
- Null : no instrumentation takes place
- FQCN : use class as instrumentation. See ExtensibilityPoints
This section declares cluster configurations - You may have zero or more Cluster section.
@name : name of the cluster. Used for ClusterManager.GetCluster()
@clusterType : name of cluster service or FQCN to provide your own.
@clusterPartitioner : name of partitioner service (default is Null)
- Null : use NullPartitioner - no partitionning
- Random : use RandomPartitioner (suitable for C* RandomPartitioner strategy)
- Murmur3 : use Murmur3Partitioner (suitable for C* Murmur3Partitioner strategy)
This section configures the endpoint of the Cassandra cluster. This section is mandatory and should at least contain one server.
@snitch : how a server is exposed internally (default is RackInferring)
- Simple : use SimpleSnitch (mostly a do nothing strategy)
- RackInferring : use RackInferringSnitch
- FQCN : use class as snith. See ExtensibilityPoints
@strategy : how a connection is choosen (default is Random)
- null/empty/Random : random endpoint
- Nearest : choose the nearest endpoint according to IP distance with client
- Random : choose a random endpoint
- RoundRobin : choose an endpoint using a round robin strategy
- TokenRing : choose an endpoint according to a partitionning key (see [Using Partition Key] (UsingPartitionKey))
- FQCN : use class as strategy. See ExtensibilityPoints
This section configure the endpoint discovery service. This section can be omitted.
@discoveryType : name of discovery service (default is SystemPeers)
- Null : no discovery
- SystemPeers : query peers/local column families to discover endpoints
@discoveryInterval : duration between discoveries (default is 5 minutes)
This section configures the transport side. This section can be omitted.
@type : type of transport (default is CqlBinary)
- null/empty/CqlBinary : use CqlBinary as connection factory.
- FQCN : use class as connection factory. See ExtensibilityPoints
@port : port for the transport (default is 9042)
@user : username for authentication
@password : password for authentication
@recoverable : tells if cluster should support endpoint recovery
@cqlver : cql version to use (default is 3.0.0)
Server : a hostname or an IP address
@keepAlive : enable tcp/ip keep alive
@keepAliveTime : keep alive time
@rcvTimeout : timeout for receive operations on socket (default is 0 : no timeout)
@sndTimeout : timeout for send operations on socket (default is 0 : no timeout)
@cl : default consistency level (default is QUORUM)
- ANY
- ONE
- TWO
- THREE
- QUORUM
- ALL
- LOCAL_QUORUM
- EACH_QUORUM
@execFlags : default execution flags (default is None)
- None : no flag
- ClientTracing : enable client side performance tracing
- ServerTracing : enable server side performance tracing
- Tracing : ClientTracing + ServerTracing