How to configure Java RestClient to talk to ElasticCluster?

I am running ES v6.3.2. I have 2 master nodes and 2 data nodes in my cluster (lets call them M1 & M2 and D1 & D2). Lets say they are running on following IPs

    M1 : 10.20.30.1:9200
    M2 : 10.20.30.2:9200
    D1 :  10.20.30.3:9200
    D2 :  10.20.30.4:9200

I am communicating with the elastic search using the Low Level Java Rest Client.

On my local machine, I had only 1 instance running and I was communicating over (localhot:9200).

HttpHost httpHost1 = new HttpHost("localhot", 9200, "http");

My question is shall I build 4 HttpHost instances to talk to ES Cluster, or should I put all 4 ES instances behind the load balancer and build 1 HttpHost instance to talk to it?

Hi,

the docs suggest to initialize the client with all nodes. Note that there is also a separate Sniffer that can auto-detect cluster nodes.

Daniel

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.