Spring data Cassandra | local data-center is taking as null

Viewed 1582

Recently started using Spring data cassandra with One Node as the contact point(not local machine). so I had to give the correct(default) data-center name as "datacenter1" to make it work as per the Datastax's Java-Driver 4.x. So far no issues;

Upon adding another node to the contact points(multiple nodes) as in below bean example, its started throwing warning saying that data-center name varies;

[s0|default] You specified datacenter1 as the local DC, but some contact points are from a different DC: Node(endPoint= <Node2 IP>:9042, hostId=null, hashCode=657776a7)=null; please provide the correct local DC, or check your contact points

[s1|default] You specified datacenter1 as the local DC, but some contact points are from a different DC: Node(endPoint= <Node2 IP>:9042, hostId=null, hashCode=19e8b806)=null; please provide the correct local DC, or check your contact points

Example Bean configuration:

@Bean
public CqlSessionFactoryBean caassSesssionFactory(){
    CqlSessionFactoryBean bean = new CqlSessionFactoryBean();
    bean.setContactPoints("<Node1 IP>, <Node2 IP>"); // Comma separated IP's
    bean.setKeyspaceName("mykeyspace");
    bean.setPort(9042);
    bean.setSchemaAction(SchemaAction.NONE);
    bean.setLocalDatacenter("datacenter1"); // both nodes having same data-center name
    return bean;
}

Upon inspecting the warning message, it seems that the data-center name is coming as null. But its not the actual case. Both node are having default name;

Info: Using Datastax java driver core version 4.6.1

Can someone please point me where am doing it wrong?

Note : If I tried using with single IP with the same "datacenter1" then its working fine for both the nodes. Warning appears only while adding multiple contact points;

Any help would be greatly appreciated. Thanks in advance :)

0 Answers
Related