# \[http.publish\_host\] was printed as \[ip:port\] instead of \[hostname/ip:port\]

**URL:** <https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820>\
**Category:** Elasticsearch\
**Created:** [March 5, 2019, 4:32am UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820 "2019-03-05T04:32:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alsheh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alsheh/32/36799_2.png) [@Alsheh](https://discuss.elastic.co/u/Alsheh)\
**Post date:** [March 5, 2019, 4:32am UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/1 "2019-03-05T04:32:33Z")

</div>

Hello,

ES, periodically, emitting the following log:

```auto
[2019-03-05T04:17:38,592][WARN][o.e.d.h.HttpInfo] [es-node-01] [http.publish_host] was printed as [ip:port] instead of [hostname/ip:port]. This format is deprecated and will change to [hostname/ip:port] in a future version. Use -Des.http.cname_in_publish_address=true to enforce non-deprecated formatting.

```

I'm not sure exactly what this means or how to resolve it. Any help would be appreciate it!

Relevant parts from elasticsearch.yml

```auto
cluster.name: ${CLUSTER_NAME} # elasticsearh-cluster
node.name: ${NODE_NAME} # es-node-01
network.host: ${node.name}
http.host: ${node.name}
http.publish_host: ${node.name}
http.port: 9200

```

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [March 6, 2019, 2:11am UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/2 "2019-03-06T02:11:38Z")

</div>

There are ES APIs that can be used to determine which nodes exist in a cluster, and what address they use for their HTTP (Rest) interface.

For example:

```auto
curl "http://localhost:9200/_nodes" | jq ".nodes[].http.publish_address"

```

Many client libraries supporting "sniffing" where they connect to one node in the cluster and then use the `_nodes` API to determine the base URLs for the other nodes.

In older versions of Elasticsearch (5.0 to 6.5) that "publish\_address" would always be an IP address, and not a CNAME (DNS/hostname).

In future versions of Elasticsearch (7.0 and later) that "publish\_address" will include both the CNAME and the IP in the format: `hostname/ip:port`

For 6.6 and later 6.x releases, this is a configurable behaviour. By default it will behave like 6.5, but you can turn on the 7.0 style behaviour.

The warning you are getting is telling you that you are using the old behaviour, but this is going to change in a future release of Elasticsearch.

If you pass `-Des.http.cname_in_publish_address=true` when you start Elasticsearch (It's a Java system property, not a setting in the yml file), then you will get the new behaviour and this warning will go away.

---

<div class="post-metadata">

**Author:** ![Alsheh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alsheh/32/36799_2.png) [@Alsheh](https://discuss.elastic.co/u/Alsheh)\
**Post date:** [March 6, 2019, 3:15am UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/3 "2019-03-06T03:15:57Z")

</div>

@TimV Thanks for the thorough explanation. Indeed, I sat the setting via the `ES_JAVA_OPTS` environment variable and that seemed to silence the warning log:

```auto
export ES_JAVA_OPTS="$ES_JAVA_OPTS -Des.http.cname_in_publish_address=true"

```

---

<div class="post-metadata">

**Author:** ![matt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt/32/524_2.png) [@matt](https://discuss.elastic.co/u/matt)\
**Post date:** [March 13, 2019, 7:29pm UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/4 "2019-03-13T19:29:26Z")

</div>

add the following to /etc/sysconfig/elasticsearch

```
# Additional Java OPTS
ES_JAVA_OPTS=-Des.http.cname_in_publish_address=true

```

and restart elasticsearch by running,

`systemctl restart elasticsearch`

---

<div class="post-metadata">

**Author:** ![Supermathie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/supermathie/32/44936_2.png) [@Supermathie](https://discuss.elastic.co/u/Supermathie)\
**Post date:** [April 1, 2019, 10:55pm UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/5 "2019-04-01T22:55:27Z")

</div>

> [@TimV](#):
>
> In future versions of Elasticsearch (7.0 and later) that "publish\_address" will include both the CNAME and the IP in the format: `hostname/ip:port`

It's really confusing getting this error message when you only have a hostname that's not a CNAME and see it complaining about a CNAME.

> [2019-04-01T22:42:01,820][WARN][o.e.d.h.HttpInfo] [YhxttGD] [http.publish\_host] was printed as [ip:port] instead of [hostname/ip:port]. This format is deprecated and will change to [hostname/ip:port] in a future version. Use -Des.http.cname\_in\_publish\_address=true to enforce non-deprecated formatting.

Instead of:

```plaintext
network.publish_host: "2b551181242e.gandalf.sd.canada.ca"

```

Should I should be using:

```plaintext
network.publish_host: "2b551181242e.gandalf.sd.canada.ca/[2001:db8::1]"

```

?

EDIT: apparently not!

```plaintext
network.publish_host: "2b551181242e.gandalf.sd.canada.ca/[2001:db8:70:83:0:2cb:32ab:ffee]"

```

```plaintext
java.net.UnknownHostException: 2b551181242e.gandalf.sd.canada.ca/[2001:db8:70:83:0:2cb:32ab:ffee]: invalid IPv6 address

```

I now have no idea what this message is asking me to fix.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [April 2, 2019, 12:51am UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/6 "2019-04-02T00:51:56Z")

</div>

> [@Supermathie](#):
>
> I now have no idea what this message is asking me to fix.

It isn't asking you to fix something.  
It is warning you that your cluster is behaving in a particular way, and that if/when you upgrade to 7.0 it will behave in a different way.

This is about your cluster sending a response, and the format of that response is going to change in 7.0; It has nothing to do with the way you are configuring your hostnames or publish addresses, it's only about how ES formats them in particular REST responses.

You don't _have_ to do anything, but **if** you have a client that relies on the current behaviour, then it will break when you upgrade to 7.0.  
The ES server cannot tell whether you have such a client we don't know how those responses are being consumed, so the only option is to issue that warning on all clusters.

If you want to silence the warning, you can do so by making the change _now_ (on 6.7) to format responses with the new (7.0) style of address. You do this by setting the `es.http.cname_in_publish_address` system problems as described above:

```auto
export ES_JAVA_OPTS="$ES_JAVA_OPTS -Des.http.cname_in_publish_address=true"

```

If you have clients that rely on the old style, then making this change could break them.

---

<div class="post-metadata">

**Author:** ![Supermathie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/supermathie/32/44936_2.png) [@Supermathie](https://discuss.elastic.co/u/Supermathie)\
**Post date:** [April 2, 2019, 1:30pm UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/7 "2019-04-02T13:30:49Z")

</div>

> [@TimV](#):
>
> It is warning you that your cluster is behaving in a particular way, and that if/when you upgrade to 7.0 it will behave in a different way.

OK, then the warning is very confusing since when I have:

```plaintext
network.publish_host: "2b551181242e.gandalf.sd.canada.ca"

```

it complains that

> `[http.publish_host] was printed as [ip:port] instead of [hostname/ip:port]`

but when actually using an ip:

```plaintext
network.publish_host: "[2001:db8:70:83:0:2cb:32ab:ffee]"

```

the warning goes away.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [April 3, 2019, 1:22am UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/8 "2019-04-03T01:22:04Z")

</div>

Yes, because it you set your `network.publish_host` to an IP address, then we will only ever publish an IP address in the REST responses.  
If you set `network.publish_host` to named address (hostname/CNAME etc) then we have 2 things that we can publish, the name and the IP. In 6.6, when we publish the node's HTTP address we just publish the IP. In 7.0 we will publish both.

---

<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:** [May 1, 2019, 1:33am UTC](https://discuss.elastic.co/t/http-publish-host-was-printed-as-ip-port-instead-of-hostname-ip-port/170820/9 "2019-05-01T01:33:04Z")

</div>

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