-
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="@recovery" logger="@logger">
<Cluster name="@clusterName">
<Behavior />
<Endpoints snitch="@snitch" strategy="@strategy">
<Server>127.0.0.1</Server>
<Server>127.0.0.2</Server>
</Endpoints>
<Transport type="@type" port="@port" user="@user" password="@password"
recoverable="@recoverable" cqlver="@cqlver" />
</Transport>
</Cluster>
</CassandraSharp>
This section declares global behavior.
@recovery : 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
@logger : name of the logger (default is Null)
- Null : use NullLogger - nothing is logged
- FQCN : use class as logger. See ExtensibilityPoints
This section declares cluster configurations - You may have zero or more Cluster section.
@name : name of the cluster. Used for ClusterManager.GetCluster()
This section configures the behavior of cassandra-sharp. This section can be omitted. Actually, no policy is available.
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
- FQCN : use class as strategy. See ExtensibilityPoints
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