DCAwareRoundRobinPolicy Class |
This policy provides round-robin queries over the node of the local datacenter. It also includes in the query plans returned a configurable number of hosts in the remote datacenters, but those are always tried after the local nodes. In other words, this policy guarantees that no host in a remote datacenter will be queried unless no host in the local datacenter can be reached.
If used with a single datacenter, this policy is equivalent to the RoundRobinPolicy policy, but its GetDatacenter awareness incurs a slight overhead so the RoundRobinPolicy policy could be preferred to this policy in that case.
Namespace: Cassandra
public class DCAwareRoundRobinPolicy : ILoadBalancingPolicy
The DCAwareRoundRobinPolicy type exposes the following members.
Name | Description | |
---|---|---|
DCAwareRoundRobinPolicy |
Creates a new datacenter aware round robin policy that auto-discover the local data-center.
If this constructor is used, the data-center used as local will the data-center of the first Cassandra node the driver connects to. This will always be ok if all the contact points use at Cluster creation are in the local data-center. If it's not the case, you should provide the local data-center name yourself by using one of the other constructor of this class. | |
DCAwareRoundRobinPolicy(String) |
Creates a new datacenter aware round robin policy given the name of the local
datacenter. The name of the local datacenter provided must be the local datacenter name as known by Cassandra. The policy created will ignore all remote hosts. In other words, this is equivalent to new DCAwareRoundRobinPolicy(localDc, 0). | |
DCAwareRoundRobinPolicy(String, Int32) |
Creates a new DCAwareRoundRobin policy given the name of the local
datacenter and that uses the provided number of host per remote
datacenter as failover for the local hosts.
The name of the local datacenter provided must be the local datacenter name as known by Cassandra. |
Name | Description | |
---|---|---|
Distance |
Return the HostDistance for the provided host. This policy consider nodes in the local datacenter as Local. For each remote datacenter, it considers a configurable number of hosts as Remote and the rest is Ignored. To configure how many host in each remote datacenter is considered Remote. | |
Initialize | ||
NewQueryPlan |
Returns the hosts to use for a new query. The returned plan will always try each known host in the local datacenter first, and then, if none of the local host is reachable, will try up to a configurable number of other host per remote datacenter. The order of the local node in the returned query plan will follow a Round-robin algorithm. |