MasterNotDiscoveredException in JAVA! Have to change the cluster name


(Cody) #1

Hey guys,

I was doing some ES test with my Java program this morning, then strange things happened - the program can be finished successfully, but I could not find any data through Sense UI. Finally, I found out that some guy in my lab (local network) is also using ES, and the java program got connected to her cluster (I guess it is multicast).

So, I decided to change my cluster to some other name other than the default one. I did two things, one is to change the cluster.name: test. The other is to change the code to
Node node =
nodeBuilder()
.settings(ImmutableSettings.settingsBuilder().put("http.enabled", false))
.clusterName("test")
.client(true)
.node();

But the MasterNotDiscoveredException came up in the end. Can someone help me? or you have some other way to solve this problem.

Thanks,
Cody


(David Pilato) #2

Upgrade! :slightly_smiling:

You should use 2.1.1 and not 1.x series.

Also prefer the TransportClient than the node client.


(Cody) #3

Thanks. I just got it fixed by myself after hours of googling. It turns out that I have to use the same version of es and java api. Because the java program was developed last year, I guess I have to stick with it. So I downloaded an old 1.7 es.


(system) #4