April 2017
Beginner to intermediate
360 pages
9h 35m
English
This policy is datacenter aware and routes queries to the local nodes first. There are two constructors for instantiating this class:
To use this policy, use the withLoadBalancingPolicy() method to set the LB policy, as follows:
Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1") .withLoadBalancingPolicy( DCAwareRoundRobinPolicy.builder() .withLocalDc("localDc") .withUsedHostsPerRemoteDc(2) .allowRemoteDCsForLocalConsistencyLevel() .build()).build();
Read now
Unlock full access