Class: DCAwareRoundRobinPolicy

policies/loadBalancing~ DCAwareRoundRobinPolicy


new DCAwareRoundRobinPolicy(localDcopt, nullable, usedHostsPerRemoteDcopt)

A data-center aware Round-robin load balancing policy. This policy provides round-robin queries over the node of the local data center. It also includes in the query plans returned a configurable number of hosts in the remote data centers, but those are always tried after the local nodes. In other words, this policy guarantees that no host in a remote data center will be queried unless no host in the local data center can be reached.
Name Type Attributes Description
localDc String <optional>
local datacenter name.
usedHostsPerRemoteDc Number <optional>
the number of host per remote datacenter that the policy will yield \ in a newQueryPlan after the local nodes.


  • LoadBalancingPolicy



Returns the distance depending on the datacenter.
Name Type Description
host Host

init(client, hosts, callback)

Initializes the load balancing policy.
Name Type Description
client Client
hosts HostMap
callback function

newQueryPlan(keyspace, queryOptions, callback)

It returns an iterator that yields local nodes first and remotes nodes afterwards. The amount of remote nodes returned will depend on the usedHostsPerRemoteDc
Name Type Description
keyspace String Name of the keyspace
callback function