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

Hello,

ES, periodically, emitting the following log:

[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

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

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:

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.

2 Likes

@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:

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

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

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:

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

Should I should be using:

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

?

EDIT: apparently not!

network.publish_host: "2b551181242e.gandalf.sd.canada.ca/[2001:db8:70:83:0:2cb:32ab:ffee]"
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.

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:

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.

1 Like

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

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:

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

the warning goes away.

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.

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