Existing cluster works with driver 2.14 using
Cluster.withLoadBalancingPolicy(new TokenAwarePolicy(new DCAwareRoundRobinPolicy()))
Please can you advise how to get the equivalent in driver 4+.
The Cluster class does not exist.
In our site we have Cassandra servers across multiple datacenters, clustered. This works using Datastax Cassandra driver 2.1.4 and the Cluster.
In 4.10, using CqlSession, and the default LBP, defining 1 localDatacenter, the Cassandra nodes in the other datacenter cannot be reached.
Using DcInferringLoadBalancingPolicy, there is no need to specify the localDatacenter, but on startup we get exception (nodes and dc names masked)
2021-03-02 09:24:20,824 ERROR Platform startup failed java.lang.IllegalStateException: No local DC was provided, but the contact points are from different DCs: Node(endPoint=xxx.domain.com:9042, hostId=870e71d8-61c5-4eef-8e83-bf5ffb3a9dec, hashCode=13379641)=DC1, Node(endPoint=yyy.domain.com:9042, hostId=26e1b758-f5d6-4016-92df-30663a8b1cf5, hashCode=24359a70)=DC2,…
please set the local DC explicitly (see basic.load-balancing-policy.local-datacenter in the config, or set it programmatically with SessionBuilder.withLocalDatacenter)
at com.datastax.oss.driver.internal.core.loadbalancing.helper.InferringLocalDcHelper.discoverLocalDc(InferringLocalDcHelper.java:79)
How can we wire up the Cassandra CqlSession for our site setup please