# Load balance in elasticsearch with multiple nodes in same machine

**URL:** <https://discuss.elastic.co/t/load-balance-in-elasticsearch-with-multiple-nodes-in-same-machine/103036>\
**Category:** Elasticsearch\
**Created:** [October 6, 2017, 2:57pm UTC](https://discuss.elastic.co/t/load-balance-in-elasticsearch-with-multiple-nodes-in-same-machine/103036 "2017-10-06T14:57:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![surajbs](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@surajbs](https://discuss.elastic.co/u/surajbs)\
**Post date:** [October 6, 2017, 2:57pm UTC](https://discuss.elastic.co/t/load-balance-in-elasticsearch-with-multiple-nodes-in-same-machine/103036/1 "2017-10-06T14:57:50Z")

</div>

Hi,

I am trying to run multiple nodes with different instances in same machine for load balancing in elasticsearch.

I have downloaded three elasticsearch files in the same machine and configured their elasticsearch.yml file with different settings. Please see below:

1. Elasticsearch - default configuration

2. Elasticsearch-node1  
[cluster.name](http://cluster.name): Animals  
[node.name](http://node.name): Snake  
node.master: true  
node.data: true  
transport.tcp.port: 9300  
http.port: 9200  
discovery.zen.ping.unicast.hosts: ["Snake", "Baboon"]

3. Elasticsearch-node2  
[cluster.name](http://cluster.name): Animals  
[node.name](http://node.name): Baboon  
node.master: false  
node.data: true  
transport.tcp.port: 9301  
http.port: 9201  
discovery.zen.ping.unicast.hosts: ["Snake", "Baboon"]

Please share your opinion and ideas on this.

Thank you.

---

<div class="post-metadata">

**Author:** ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)\
**Post date:** [October 6, 2017, 3:26pm UTC](https://discuss.elastic.co/t/load-balance-in-elasticsearch-with-multiple-nodes-in-same-machine/103036/2 "2017-10-06T15:26:32Z")

</div>

You don't really need three different binaries (at least on Linux). You can start separate processes with different config files and data paths...

I would leave all as `node.master: true`. You are also using both for `discovery.zen.ping.unicast.hosts:`

Default is ports `9200/9300` so node1 (your second node) can't use those, bump them up with one for second and third node.

I'm running 5 nodes on same machine on 6 machines in total over two clusters. Definitely can be done 🙂

---

<div class="post-metadata">

**Author:** ![surajbs](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@surajbs](https://discuss.elastic.co/u/surajbs)\
**Post date:** [October 18, 2017, 4:07pm UTC](https://discuss.elastic.co/t/load-balance-in-elasticsearch-with-multiple-nodes-in-same-machine/103036/3 "2017-10-18T16:07:53Z")

</div>

Hi,

Thanks for the response.

I am able to create multiple instances with the nodes.

Please find my elasticsearch.yml config below.

- Elasticsearch - default configuration

- Elasticsearch-node1  
[cluster.name](http://cluster.name): Animals  
[node.name](http://node.name): Snake  
node.master: true  
node.data: true  
path.data: "C:\elasticsearch-5.4.2-node1\elasticsearch-5.4.2\data"  
path.logs: "C:\elasticsearch-5.4.2-node1\elasticsearch-5.4.2\logs"  
http.port: 9201  
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

- Elasticsearch-node2  
[cluster.name](http://cluster.name): Animals  
[node.name](http://node.name): Baboon  
node.master: false  
node.data: true  
path.data: "C:\elasticsearch-5.4.2-node2\elasticsearch-5.4.2\data"  
path.logs: "C:\elasticsearch-5.4.2-node2\elasticsearch-5.4.2\logs"  
http.port: 9202  
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

## FYI, the status is red in the cluster health.

And I am using logstash to load the csv file into elasticsearch for which I have used the below config. But I am not able to see the other instances(9201 and 9202) loading the data.

output  
{   
elasticsearch {  
hosts =\> ["localhost:9200", "localhost:9201", "localhost:9202"]  
index =\> "cmss"  
document\_type =\> "cms"  
document\_id =\> "%{id}"  
}  
}

Thank you.

---

<div class="post-metadata">

**Author:** ![surajbs](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@surajbs](https://discuss.elastic.co/u/surajbs)\
**Post date:** [October 18, 2017, 4:50pm UTC](https://discuss.elastic.co/t/load-balance-in-elasticsearch-with-multiple-nodes-in-same-machine/103036/4 "2017-10-18T16:50:59Z")

</div>

Hi,

Thanks for the response.

I am able to create multiple instances with the nodes.

Please find my elasticsearch.yml config below.

Elasticsearch - default configuration

Elasticsearch-node1  
[cluster.name](http://cluster.name): Animals  
[node.name](http://node.name): Snake  
node.master: true  
node.data: true  
path.data: "C:\elasticsearch-5.4.2-node1\elasticsearch-5.4.2\data"  
path.logs: "C:\elasticsearch-5.4.2-node1\elasticsearch-5.4.2\logs"  
http.port: 9201  
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

Elasticsearch-node2  
[cluster.name](http://cluster.name): Animals  
[node.name](http://node.name): Baboon  
node.master: false  
node.data: true  
path.data: "C:\elasticsearch-5.4.2-node2\elasticsearch-5.4.2\data"  
path.logs: "C:\elasticsearch-5.4.2-node2\elasticsearch-5.4.2\logs"  
http.port: 9202  
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

FYI, the status is red in the cluster health.  
And I am using logstash to load the csv file into elasticsearch for which I have used the below config. But I am not able to see the other instances(9201 and 9202) loading the data.

output  
{   
elasticsearch {  
hosts =\> ["localhost:9200", "localhost:9201", "localhost:9202"]  
index =\> "cmss"  
document\_type =\> "cms"  
document\_id =\> "%{id}"  
}  
}

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 15, 2017, 4:51pm UTC](https://discuss.elastic.co/t/load-balance-in-elasticsearch-with-multiple-nodes-in-same-machine/103036/5 "2017-11-15T16:51:05Z")

</div>

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