# How to run multiple client nodes on one host

**URL:** <https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059>\
**Category:** Elasticsearch\
**Created:** [February 5, 2016, 12:35pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059 "2016-02-05T12:35:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvoros](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bvoros/32/5246_2.png) [@bvoros](https://discuss.elastic.co/u/bvoros)\
**Post date:** [February 5, 2016, 12:35pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/1 "2016-02-05T12:35:33Z")

</div>

Hello All,

Could someone explain how to run multiple client nodes on a single host?

Is this documented somewhere? I have been leafing through the docs without luck.

Thanks in advance,

---

<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 5, 2016, 1:10pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/2 "2016-02-05T13:10:12Z")

</div>

Something like:

```auto
bin/elasticsearch --node.client=true &
bin/elasticsearch --node.client=true &
bin/elasticsearch --node.client=true &
bin/elasticsearch --node.client=true &

```

?

What is your use case?

---

<div class="post-metadata">

**Author:** ![bvoros](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bvoros/32/5246_2.png) [@bvoros](https://discuss.elastic.co/u/bvoros)\
**Post date:** [February 5, 2016, 1:18pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/3 "2016-02-05T13:18:22Z")

</div>

Hi,

Thanks for the quick response.

So there is a cluster of six nodes, running on VMWare on six VMs on their own network.

There is also an application being developed and it would have two components as two client only nodes.  
These two are in Docker.

I am trying to figure out how to run both client nodes on a single Docker machine.  
Have been playing with all sorts of port mappings without luck.

This is why I wanted to know how to configure multiple nodes on one host, then apply that somehow to Docker.

Right now it only works if the port is mapped directly (-p 9300:9300).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [February 5, 2016, 2:01pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/4 "2016-02-05T14:01:18Z")

</div>

> [@bvoros](#):
>
> So there is a cluster of six nodes, running on VMWare on six VMs on their own network.

These aren't on the same host from Elasticseach's perspective. You are responsible for telling them that they are on the same physical hardware with [allocation awareness](https://www.elastic.co/guide/en/elasticsearch/reference/2.2/allocation-awareness.html).

> [@bvoros](#):
>
> There is also an application being developed and it would have two components as two client only nodes. These two are in Docker.

I imagine it'd be simpler to have the docker applications just talk to the cluster directly.

> [@bvoros](#):
>
> Right now it only works if the port is mapped directly (-p 9300:9300).

By default Elasticsearch will grab the next available port in the 9300-3399 range. You can lock that down with the `transport.tcp.port` setting. I imagine the second elasticsearch that you run gets a different port.

---

<div class="post-metadata">

**Author:** ![bvoros](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bvoros/32/5246_2.png) [@bvoros](https://discuss.elastic.co/u/bvoros)\
**Post date:** [February 5, 2016, 3:23pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/5 "2016-02-05T15:23:27Z")

</div>

Hi,

Thanks a lot for the allocation awareness tip. I will apply that as they are spread between two hardware hosts.

My question is exactly this, I am trying to run two client nodes on a single docker machine in two separate containers.  
The client nodes would be joining the cluster.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [February 5, 2016, 3:56pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/6 "2016-02-05T15:56:25Z")

</div>

> [@bvoros](#):
>
> My question is exactly this, I am trying to run two client nodes on a single docker machine in two separate containers.The client nodes would be joining the cluster.

Right. I'm telling you two things:

1. You probably don't need client nodes at all.
2. If you really want them then one thing that should work is to give each docker node its own port and set the Elasticsearch config so each elasticsearch tries to pick up the forwarded port rather than the default range.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 6, 2016, 1:33am UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/7 "2016-02-06T01:33:18Z")

</div>

I'm not seeing the benefits to running multiple clients in a single container, over just having multiple containers?

---

<div class="post-metadata">

**Author:** ![bvoros](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bvoros/32/5246_2.png) [@bvoros](https://discuss.elastic.co/u/bvoros)\
**Post date:** [February 6, 2016, 6:45pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/8 "2016-02-06T18:45:42Z")

</div>

Hi,

This is exactly what I am trying to achieve. multiple ES client only nodes in a Docker container each on a single Docker machine.

docker run clientnode1 -p 9300-9400:9300  
docker run clientnode2 -p 9300-9400:9300  
docker run clientnode3 -p 9300-9400:9300

The example above unfortunately does not work.

It only works when mapping the ports like -p 9300:9300. This hoever limits the number of nodes to one on a single Docker machine.

Even a mapping of -p 9301:9301 does not work.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 6, 2016, 7:17pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/9 "2016-02-06T19:17:42Z")

</div>

Why do you need more than one client node on a single host?

---

<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:** [July 5, 2017, 11:18pm UTC](https://discuss.elastic.co/t/how-to-run-multiple-client-nodes-on-one-host/41059/10 "2017-07-05T23:18:25Z")

</div>


