# ES 6.5.2 Problem making zen unicast discovery to work when transport.tcp.port is set

**URL:** <https://discuss.elastic.co/t/es-6-5-2-problem-making-zen-unicast-discovery-to-work-when-transport-tcp-port-is-set/166228>\
**Category:** Elasticsearch\
**Created:** [January 29, 2019, 7:58pm UTC](https://discuss.elastic.co/t/es-6-5-2-problem-making-zen-unicast-discovery-to-work-when-transport-tcp-port-is-set/166228 "2019-01-29T19:58:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [January 29, 2019, 7:58pm UTC](https://discuss.elastic.co/t/es-6-5-2-problem-making-zen-unicast-discovery-to-work-when-transport-tcp-port-is-set/166228/1 "2019-01-29T19:58:57Z")

</div>

Hi Team,

I have set my `discovery.zen.ping.unicast.hosts: ["hostA", "hostB", "hostC"]` without a port range which according to the [docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html) I believe should scan a range of ports by default which looks like it does.

Now for one of my coordinator nodes that has the above `discovery.zen.ping.unicast.hosts` setting, I want to set a custom fixed transport port say 9500 so I set `transport.tcp.port: 9500` but when the coordinator starts up it complains that it cannot find any master nodes.

Looking at the logs, it looks like for some reason the coordinator overrides the default zen unicast discovery port range with port 9500 which makes it unable to discovery anything.

I tried to play around and set `transport.profiles.default.port: 9300-9400` cos according to the [docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#unicast):

> The list of hosts is set using the `discovery.zen.ping.unicast.hosts` static setting. This is either an array of hosts or a comma-delimited string. Each value should be in the form of `host:port` or `host` (where `port` defaults to the setting `transport.profiles.default.port` falling back to `transport.tcp.port` if not set).

So I thought it might work but then this seems to replace `transport.tcp.port` which makes my coordinator not bind to transport port 9500.

In summary, what I want my coordinator to have is a `"transport_address" : "SOME_IP:9500"` and still be able to discover things with `discovery.zen.ping.unicast.hosts: ["hostA", "hostB", "hostC"]` - is that possible?

Many thanks for your help,

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [January 30, 2019, 8:56am UTC](https://discuss.elastic.co/t/es-6-5-2-problem-making-zen-unicast-discovery-to-work-when-transport-tcp-port-is-set/166228/2 "2019-01-30T08:56:57Z")

</div>

Elasticsearch will scan five ports on `localhost` if you do not set `discovery.zen.ping.unicast.hosts` but does not do any port scanning if you do set this setting. This is a convenience feature for quick setups on a single host, but in any realistic production cluster you should give a specific port to each master-eligible node and specify that port in the addresses given in the `discovery.zen.ping.unicast.hosts` setting if needed:

```nohighlight
discovery.zen.ping.unicast.hosts: ["hostA", "hostB:9500", "hostC"]

```

You only need to be able to discover the master-eligible nodes, so you can bind master-ineligible nodes to port ranges if you want since their ports do not really matter.

The relevant code, if you're interested, is here:

> <https://github.com/elastic/elasticsearch/blob/022726011ce1d9e4748fd39293a3aeae6954b3ac/server/src/main/java/org/elasticsearch/discovery/zen/SettingsBasedHostsProvider.java#L50-L66>

---

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [January 30, 2019, 10:08am UTC](https://discuss.elastic.co/t/es-6-5-2-problem-making-zen-unicast-discovery-to-work-when-transport-tcp-port-is-set/166228/3 "2019-01-30T10:08:41Z")

</div>

Thanks David, it is much clearer now.

---

<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:** [February 27, 2019, 10:08am UTC](https://discuss.elastic.co/t/es-6-5-2-problem-making-zen-unicast-discovery-to-work-when-transport-tcp-port-is-set/166228/4 "2019-02-27T10:08:41Z")

</div>

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