1
votes

I am not getting, HostDistance concept means it has LOCAL or REMOTE value. Need to set it while creating connections i.e core/max in pooling options using java API.

Question is

  1. Do we need to set HostDistance values for each node in cluster? if yes how?

or

  1. Does it depend on loadBalancing policy? If yes,how?,since we don't specify it in load balancing policy as per my understanding. If no, how it decides HostDistance then?

I read these links

https://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/policies/LoadBalancingPolicy.html#distance-com.datastax.driver.core.Host-

https://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/HostDistance.html

Please correct my understanding. Thanks!

1

1 Answers

1
votes

HostDistance is used for your client, so it could maintain pool & not to open too many connections to remote data center. The distance is calculated by implementation LoadBalancingPolicy that will use implementation-specific algorithm to mark Cassandra node as LOCAL or REMOTE.

See Connection Pooling & Load Balancing sections in Java Driver documentation for additional explanation.