# Set up Elasticsearch cluster 2 nodes on same machine

**URL:** <https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824>\
**Category:** Elasticsearch\
**Created:** [February 21, 2018, 11:31am UTC](https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824 "2018-02-21T11:31:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darshan\_Shah1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Darshan\_Shah1](https://discuss.elastic.co/u/Darshan_Shah1)\
**Post date:** [February 21, 2018, 11:31am UTC](https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824/1 "2018-02-21T11:31:04Z")

</div>

Hi ,  
The requirement is need to set up two nodes of cluster on same host. if I use network.host: with same IP  
http.port : different port

Below is my config file for node-1. In 2nd node cluster name is same,node name is different , network ip is same and port number is different. when I start service for node-1 it's working fine. but elasticsearch service for node cannot start. Could any one please suggest what I missed.

The configuration file (elasticsearch.yml)for node-1 has below settings.  
---------------------------------- Cluster -----------------------------------  
cluster.name: "Test ES Cluster"  
------------------------------------ Node ------------------------------------  
node.name: "node-1"  
---------------------------------- Network -----------------------------------  
network.host: 10.1.1.101  
http.port: 9201

The configuration file (elasticsearch.yml)for node-2 has below settings.  
---------------------------------- Cluster -----------------------------------  
cluster.name: "Test ES Cluster"  
------------------------------------ Node ------------------------------------  
node.name: "node-2"  
---------------------------------- Network -----------------------------------  
network.host: 10.1.1.101  
http.port: 9202

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 21, 2018, 11:42am UTC](https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824/2 "2018-02-21T11:42:20Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

---

<div class="post-metadata">

**Author:** ![Darshan\_Shah1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Darshan\_Shah1](https://discuss.elastic.co/u/Darshan_Shah1)\
**Post date:** [February 21, 2018, 12:25pm UTC](https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824/3 "2018-02-21T12:25:06Z")

</div>

Sure. Thanks David.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 21, 2018, 12:49pm UTC](https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824/4 "2018-02-21T12:49:22Z")

</div>

You need to tell the discovery how to discover the other nodes. See [https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html)

Note that it's not really recommended to have multiple nodes per machine unless you have more than 64 gb of physical RAM on your machine.  
Is it your case?

---

<div class="post-metadata">

**Author:** ![Darshan\_Shah1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Darshan\_Shah1](https://discuss.elastic.co/u/Darshan_Shah1)\
**Post date:** [February 21, 2018, 1:21pm UTC](https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824/5 "2018-02-21T13:21:58Z")

</div>

Hi David,  
You are right, there is no meaning of cluster node on same server. However for now on our dev server we need to configure it on same server with two nodes. so as mentioned in document you suggested, I want to set two nodes on same server. and trying ...  
"Out of the box, without any network configuration, Elasticsearch will bind to the available loopback addresses and will scan ports 9300 to 9305 to try to connect to other nodes running on the same server. This provides an auto- clustering experience without having to do any configuration."

I also tried with  
discovery.zen.ping.unicast.hosts: ["10.1.1.101:9300","10.1.1.101:9304"]. but with these settings,I can not start elasticsearch services.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 21, 2018, 1:57pm UTC](https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824/6 "2018-02-21T13:57:23Z")

</div>

So if it's for dev only, like running locally, you don't need to set anything like `network.host` and `discovery.zen.ping.unicast.hosts` as this will work OOTB.

But if you did not create multiple installation directories, you might have to add `node.max_local_storage_nodes: 4` in your `elasticsearch.yml`.

If you don't succeed, please share your `elasticsearch.yml` and your logs (formatted as I explained before - you did it wrong again in your first post)

---

<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:** [March 21, 2018, 1:57pm UTC](https://discuss.elastic.co/t/set-up-elasticsearch-cluster-2-nodes-on-same-machine/120824/7 "2018-03-21T13:57:33Z")

</div>

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