# Where to place unicast\_hosts.txt file for cluster setup in ES 6.5

**URL:** <https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799>\
**Category:** Elasticsearch\
**Created:** [May 20, 2019, 11:00am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799 "2019-05-20T11:00:07Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suryadip\_Nag](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Suryadip\_Nag](https://discuss.elastic.co/u/Suryadip_Nag)\
**Post date:** [May 20, 2019, 11:00am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/1 "2019-05-20T11:00:07Z")

</div>

Where to place unicast\_hosts.txt file for cluster setup in ES 6.5?

In elasticsearch website (6.5) it is mentioned to put the unicast\_hosts.txt file in below directory:

$ES\_PATH\_CONF/discovery-file/unicast\_hosts.txt

I have installed ES 6.5

[root@xxxx discovery-file]# pwd  
**/usr/share/elasticsearch/plugins/discovery-file**  
[root@xxxx discovery-file]# ls -ltr  
total 28  
-rw-r--r--. 1 root root 1503 May 20 16:21 plugin-descriptor.properties  
-rw-r--r--. 1 root root 152 May 20 16:21 NOTICE.txt  
-rw-r--r--. 1 root root 6368 May 20 16:21 discovery-file-6.5.4.jar  
-rw-r--r--. 1 root root 11358 May 20 16:21 LICENSE.txt

Now do I need to put the unicast\_hosts.txt inside discovery-file-6.5.4.jar or just in this directory.

Please suggest!

---

<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:** [May 20, 2019, 11:45am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/2 "2019-05-20T11:45:16Z")

</div>

No. It should be in the elasticsearch config dir. The same directory as you have `elasticsearch.yml`.

So if your config dir is: `/foo`, then place this file under `/foo/discovery-file/unicast_hosts.txt`.

depending on how you installed elasticsearch, it might be in `/etc/elasticsearch/discovery-file/unicast_hosts.txt`.

---

<div class="post-metadata">

**Author:** ![Suryadip\_Nag](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Suryadip\_Nag](https://discuss.elastic.co/u/Suryadip_Nag)\
**Post date:** [May 20, 2019, 11:50am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/3 "2019-05-20T11:50:57Z")

</div>

Oh okay. Got it. But one doubt,

In our project elasticsearch.yml file present in /etc/elasticsearch

-rw-r-xr-x 1 root space 2656 Oct 9 2018 java.policy  
-rw-r-xr-x 1 root space 12422 Apr 16 16:10 log4j2.properties  
drwxr-x--- 2 root space 4096 May 11 03:34 scripts  
-rw-r-xr-x 1 root space 3196 May 11 03:34 jvm.options  
-rw-rw---- 1 elasticsearch space 207 May 11 03:35 elasticsearch.keystore  
-rw-r-xr-x 1 elasticsearch space 1016 May 20 11:20 **elasticsearch.yml**

So we have to create a sub-directory `discovery-file` under `/etc/elasticsearch` and then we have to keep the unicast\_hosts.xt file over here. Am I correct?

---

<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:** [May 20, 2019, 11:57am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/4 "2019-05-20T11:57:05Z")

</div>

Correct.

---

<div class="post-metadata">

**Author:** ![Suryadip\_Nag](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Suryadip\_Nag](https://discuss.elastic.co/u/Suryadip_Nag)\
**Post date:** [May 20, 2019, 2:08pm UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/5 "2019-05-20T14:08:26Z")

</div>

I have done like this but still no luck...

[root@xxxxxx elasticsearch]# pwd  
**/etc/elasticsearch**  
[root@xxxxxx elasticsearch]# ls -ltr  
total 40  
-rw-r-xr-x 1 root space 2656 Oct 9 2018 java.policy  
-rw-r-xr-x 1 root space 12422 Apr 16 16:10 log4j2.properties  
drwxr-x--- 2 root space 4096 May 9 08:29 scripts  
-rw-r-xr-x 1 root space 3196 May 9 08:29 jvm.options  
-rw-rw---- 1 elasticsearch space 207 May 9 08:33 elasticsearch.keystore  
-rw-r-xr-x 1 elasticsearch space 1016 May 20 11:19 **elasticsearch.yml**  
drwxr-xr-x 2 root root 4096 May 20 13:53 **discovery-file**  
[root@xxxxxx elasticsearch]# cd discovery-file  
[root@xxxxxx discovery-file]# **ls -ltr**  
total 4  
-rwxr-xr-x 1 root root 1023 May 20 13:53 **unicast\_hosts.txt**

I have mentioned the node ips with 9300 port in unicast\_hosts.txt file but still cluster is not formed. But cluster is formed if we put node ips in discovery.zen.ping.unicast.hosts in elasticsearch.yml file...

We need to use unicast\_hosts.txt only..Please help.

---

<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:** [May 20, 2019, 3:01pm UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/6 "2019-05-20T15:01:08Z")

</div>

What is your `elasticsearch.yml` looking like when you add the discovery-file configuration?  
What are elasticsearch logs?

I wonder if `discovery-file` dir and files should not belong to `elasticsearch` user instead BTW.

---

<div class="post-metadata">

**Author:** ![Suryadip\_Nag](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Suryadip\_Nag](https://discuss.elastic.co/u/Suryadip_Nag)\
**Post date:** [May 21, 2019, 8:36am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/7 "2019-05-21T08:36:08Z")

</div>

This is **elasticsearch.yml content** in one of the node... **is anything I missed**?

```auto
cluster.name: log ****
path.data: /var/cache/secmgt-elastic-data/log ****
path.logs: /var/log/elasticsearch
node.master: true
node.data: true
bootstrap.memory_lock: true # this one added new
#discovery.zen.ping.unicast.hosts: ["127.0.0.1:9302", "127.0.0.1:9303"]
#discovery.zen.ping.unicast.hosts: ["10.X.X.250:9300", "10.X.X.249:9300"]
#set the master node IP if the master is remote

#Configuration to check out of memory error
indices.fielddata.cache.size: 40%
indices.breaker.fielddata.limit: 60%
indices.breaker.request.limit: 40%
indices.breaker.total.limit: 70%
#Configuration to enable performance Writes
#index.translog.flush_threshold_size: 1gb //need to set
#index.refresh_interval: 10s //need to set
#set the following only on SSD, default is good for spin disk
#indices.store.throttle.max_bytes_per_sec: 100mb
bootstrap.system_call_filter: false
network.host: 0.0.0.0
network.publish_host: _eth0_

```

------ END ------

I have disabled discovery.zen.ping.unicast.hosts so that the host details should be read from unicast\_hosts.txt not directly from yml file.

`discovery-file` dir and files have been changed to elasticsearch user still issue persists, previously it was root user.

Please let me know if anything needs to be added in **elasticsearch.yml** file to form the cluster by reading **unicast\_hosts.txt**?

---

<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:** [May 21, 2019, 9:01am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/8 "2019-05-21T09:01:36Z")

</div>

Hmmm. I think that you need to add:

```auto
discovery.type: file

```

But I can't find this in the documentation 😏  
Could you try and tell me if this works?

---

<div class="post-metadata">

**Author:** ![Suryadip\_Nag](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Suryadip\_Nag](https://discuss.elastic.co/u/Suryadip_Nag)\
**Post date:** [May 21, 2019, 9:27am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/9 "2019-05-21T09:27:50Z")

</div>

No Man..Elasticsearch is not starting after I have added that in yml file.

`Error logs:`

java.lang.IllegalArgumentException: **Unknown discovery type [file]**  
at org.elasticsearch.discovery.DiscoveryModule.(DiscoveryModule.java:134) ~[elasticsearch-6.5.4.jar:6.5.4]  
at org.elasticsearch.node.Node.(Node.java:529) ~[elasticsearch-6.5.4.jar:6.5.4]

`Is unicast_hosts.txt based cluster formation really works in ES 6.5.4 ?`

---

<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:** [May 21, 2019, 10:12am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/10 "2019-05-21T10:12:51Z")

</div>

Ok. Thanks for confirming. So this is not needed and should work out of the box.

Could you share your elasticsearch logs?

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
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

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

---

<div class="post-metadata">

**Author:** ![Suryadip\_Nag](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Suryadip\_Nag](https://discuss.elastic.co/u/Suryadip_Nag)\
**Post date:** [May 21, 2019, 10:19am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/11 "2019-05-21T10:19:05Z")

</div>

The issue is resolved. 🙂

I have added this below entry in yml file and it worked.

`discovery.zen.hosts_provider: file`

You were correct but I think you just did a typo

```auto
discovery.type: file

```

Thank you very much for the help!

---

<div class="post-metadata">

**Author:** ![Suryadip\_Nag](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Suryadip\_Nag](https://discuss.elastic.co/u/Suryadip_Nag)\
**Post date:** [May 24, 2019, 5:44am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/12 "2019-05-24T05:44:25Z")

</div>

Another thing 🙂

Do I need to have the `unicast_hosts.txt` file with the node IPs only on the master node OR I need to have the text file in all the other nodes as well?

---

<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:** [May 24, 2019, 6:10am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/13 "2019-05-24T06:10:47Z")

</div>

All nodes need to know where to find a master node.

---

<div class="post-metadata">

**Author:** ![Suryadip\_Nag](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Suryadip\_Nag](https://discuss.elastic.co/u/Suryadip_Nag)\
**Post date:** [May 24, 2019, 6:12am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/14 "2019-05-24T06:12:27Z")

</div>

Okay so need to keep the unicast\_hosts.txt file in all the nodes....

---

<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:** [June 21, 2019, 6:12am UTC](https://discuss.elastic.co/t/where-to-place-unicast-hosts-txt-file-for-cluster-setup-in-es-6-5/181799/15 "2019-06-21T06:12:29Z")

</div>

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