.withLocalDc(config.getDcAwareLocalDC()); if (config.getDcAwareUsedHostsPerRemoteDc() > 0) { builder.withUsedHostsPerRemoteDc(config.getDcAwareUsedHostsPerRemoteDc()); if (config.isDcAwareAllowRemoteDCsForLocal()) { builder.allowRemoteDCsForLocalConsistencyLevel();
DCAwareRoundRobinPolicy.Builder policyBuilder = DCAwareRoundRobinPolicy.builder(); policyBuilder.withLocalDc(localdc == null ? "DC1" : localdc); policyBuilder.withUsedHostsPerRemoteDc(usedHostsPerRemoteDc != null ? Integer .parseInt(usedHostsPerRemoteDc) : 0); if (allowRemoteDCsForLocalConsistencyLevel != null
.withLocalDc(getConfiguration() .getTokenAwareLoadBalancingLocalDC().get()) .withUsedHostsPerRemoteDc(getConfiguration(). getTokenAwareLoadBalancingUsedHostsPerRemoteDc()) .allowRemoteDCsForLocalConsistencyLevel()
DCAwareRoundRobinPolicy.builder() .withLocalDc(datacenter(1)) .withUsedHostsPerRemoteDc(2) .build()) .build();
.withUsedHostsPerRemoteDc(usedHostsPerRemoteDc) .build();
DCAwareRoundRobinPolicy dcAwareRoundRobinPolicy = DCAwareRoundRobinPolicy.builder().withUsedHostsPerRemoteDc(1).build();
.withPort(sCluster.getBinaryPort()) .withLoadBalancingPolicy( DCAwareRoundRobinPolicy.builder().withUsedHostsPerRemoteDc(2).build()) .build();
.withUsedHostsPerRemoteDc(usedHostsPerRemoteDc) .build();
@Override public LoadBalancingPolicy build() { DCAwareRoundRobinPolicy.Builder builder = DCAwareRoundRobinPolicy.builder(); if (allowRemoteDCsForLocalConsistencyLevel == Boolean.TRUE) { builder.allowRemoteDCsForLocalConsistencyLevel(); } if (localDC != null) { builder.withLocalDc(localDC); } if (usedHostsPerRemoteDC != null) { builder.withUsedHostsPerRemoteDc(usedHostsPerRemoteDC); } return builder.build(); } }
@Override public LoadBalancingPolicy build() { DCAwareRoundRobinPolicy.Builder builder = DCAwareRoundRobinPolicy.builder(); if (allowRemoteDCsForLocalConsistencyLevel == Boolean.TRUE) { builder.allowRemoteDCsForLocalConsistencyLevel(); } if (localDC != null) { builder.withLocalDc(localDC); } if (usedHostsPerRemoteDC != null) { builder.withUsedHostsPerRemoteDc(usedHostsPerRemoteDC); } return builder.build(); } }
public DCAwareRoundRobinPolicy(String localDc, int usedHostsPerRemoteDc) { builder.withLocalDc(localDc) .withUsedHostsPerRemoteDc(usedHostsPerRemoteDc); }
public DCAwareRoundRobinPolicy(String localDc, int usedHostsPerRemoteDc, boolean allowRemoteDCsForLocalConsistencyLevel) { builder.withLocalDc(localDc) .withUsedHostsPerRemoteDc(usedHostsPerRemoteDc); if(allowRemoteDCsForLocalConsistencyLevel){ builder.allowRemoteDCsForLocalConsistencyLevel(); } }
/** * Creates a new {@code PartitionAware} policy with additional default data-center awareness. */ public PartitionAwarePolicy() { this(new DCAwareRoundRobinPolicy.Builder() .withUsedHostsPerRemoteDc(Integer.MAX_VALUE) .build()); }
DCAwareRoundRobinPolicy.builder() .withLocalDc(ScassandraCluster.datacenter(2)) .withUsedHostsPerRemoteDc(3) .build())) .build();
DCAwareRoundRobinPolicy.builder() .allowRemoteDCsForLocalConsistencyLevel() .withUsedHostsPerRemoteDc(2) .build()) .build();
LoadBalancingPolicy loadBalancingPolicy = HostFilterPolicy.fromDCWhiteList( DCAwareRoundRobinPolicy.builder().withUsedHostsPerRemoteDc(2).build(), Lists.newArrayList(datacenter(1), datacenter(2))); Cluster cluster =
DCAwareRoundRobinPolicy.builder() .withLocalDc(datacenter(1)) .withUsedHostsPerRemoteDc(2) .build()) .build();
.withPort(sCluster.getBinaryPort()) .withLoadBalancingPolicy( DCAwareRoundRobinPolicy.builder().withUsedHostsPerRemoteDc(2).build()) .build();
.withPort(sCluster.getBinaryPort()) .withLoadBalancingPolicy( DCAwareRoundRobinPolicy.builder().withUsedHostsPerRemoteDc(2).build()) .build();
LoadBalancingPolicy loadBalancingPolicy = HostFilterPolicy.fromDCBlackList( DCAwareRoundRobinPolicy.builder().withUsedHostsPerRemoteDc(2).build(), Lists.newArrayList(datacenter(2))); Cluster cluster =