Reputation: 1763
I was facing local DC issue connecting to cassandra from intellij IDE. It says that the local DC must be explicitly set. I am providing the below details
hosts : cassandra.prod-az-southcentralus-301.prod.us.net
port : 9042
Authentication : User & Password
User : svcproduser
Password : xxxx
Keyspace : my_cassandra
Using Apache Cassandra driver 1.4 version . I do not see any option to set local DC.Can you help on how you connect to cassandra from Intellij?
Error :
Unexpected error while creating connection. Since you provided explicit contact points, the local DC must be explicitly set (see basic.load-balancing-policy.local-datacenter in the config, or set it programmatically with SessionBuilder.withLocalDatacenter). Current contact points are: Node(endPoint=cassandra.prod-az-southcentralus-301.prod.us.net/<unresolved>:9042, hostId=ccb86d7f-7f2d-4c63-9f07-c45c7849db91, hashCode=36891956)=southcentralus-d. Current DCs in this cluster are: southcentralus-d, westus2-d.
Upvotes: 1
Views: 256
Reputation: 16353
To add to @Jane He's answer, the default load balancing policy for the driver requires the name of the data centre local to the contact points. The driver only contacts nodes in the local DC unless the default behaviour is overridden by allowing remote nodes (not recommended).
For details, see the Cassandra Java driver Quickstart and Load balancing guides. Cheers!
Upvotes: 0
Reputation: 116
Click "Advanced", at "VM options", put "-Ddatastax-java-driver.basic.load-balancing-policy.local-datacenter=datacenter1"
Upvotes: 6