# Upgrading to ES 2.2.0 doesn't allow node to have different bind and publish addresses

**URL:** <https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290>\
**Category:** Elasticsearch\
**Created:** [February 9, 2016, 3:29pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290 "2016-02-09T15:29:28Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmorgs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/schmorgs/32/39476_2.png) [@schmorgs](https://discuss.elastic.co/u/schmorgs)\
**Post date:** [February 9, 2016, 3:29pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/1 "2016-02-09T15:29:28Z")

</div>

Just tried to upgrade from 2.1.0 to 2.2.0 but having a problem with the network bind\_host and publish\_host settings.

In 2.1.0, we have this config. Bind\_host is set to loopback so that it cannot be connected to remotely (over http) as we run the node behind a reverse proxy, and publish\_host set to external interface.

```auto
network.bind_host: 127.0.0.1
network.publish_host: myhostname
transport.bind_host: myhostname

```

This worked just fine, but when I try this in 2.2.0, the node starts and then dies with a message like this : (myhostname and 1.2.3.4 hashing out real values)

```auto
[2016-02-09 15:14:09,114][ERROR][bootstrap] [myhostname] Exception
BindHttpException[Publish address [myhostname/1.2.3.4] does not match any of the bound addresses [[127.0.0.1:9200]]]

```

It seems that bind and publish values must now be the same, which kind of breaks things as I can't secure the listener to loopback without also setting the publish host to loopback which means the node can't talk to anything else.

Any way round this?

---

<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 10, 2016, 2:55am UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/2 "2016-02-10T02:55:29Z")

</div>

Try setting an actual IP or interface.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [February 10, 2016, 8:20am UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/3 "2016-02-10T08:20:45Z")

</div>

If you study the change

> <https://github.com/elastic/elasticsearch/commit/1902c66aaf95d88d6ec78e49bb3f73f7ad6c2ee9>

you can probably work around that by assigning a fixed HTTP port number.

---

<div class="post-metadata">

**Author:** ![schmorgs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/schmorgs/32/39476_2.png) [@schmorgs](https://discuss.elastic.co/u/schmorgs)\
**Post date:** [February 10, 2016, 9:21am UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/4 "2016-02-10T09:21:41Z")

</div>

Still no joy.

I've tried various settings including

```auto
network.publish_host: 1.2.3.4
http.port: 9200
transport.tcp.port: 9300

```

Same error each time :

```auto
Exception in thread "main" BindHttpException[Publish address [/1.2.3.4] does not match any of the bound addresses [[127.0.0.1:9200]]]
	at org.elasticsearch.http.netty.NettyHttpServerTransport.doStart(NettyHttpServerTransport.java:279)

```

I looked at the code but confess to not being a developer and so don't really understand what it's doing under the hood to know what else to change.

---

<div class="post-metadata">

**Author:** ![Suny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suny/32/22082_2.png) [@Suny](https://discuss.elastic.co/u/Suny)\
**Post date:** [February 11, 2016, 3:07pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/5 "2016-02-11T15:07:42Z")

</div>

For me, this is a major issue. I prevents me from using elasticsearch 2.2, because my docker setup relies on the bind host being different from the publish host. Published host is the container host's IP so the rest of the world can find the node, but it's not allowed to bind to it.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [February 11, 2016, 3:45pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/6 "2016-02-11T15:45:57Z")

</div>

Yes, I agree, to me it's also a major issue.

Seems I can not deploy on Docker anymore ☹

I can also see the bug in this example

```auto
  "network" : {
     "host" : "1.2.3.4",
     "port" : 9302
  },
  "http" : {
     "bind_host" : "0.0.0.0",
     "publish_host" : "1.2.3.4",
     "port" : 9203
  },

```

ES tries to bind to 0.0.0.0:9200 (!) which is definitely ignoring `http.port`.

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [February 11, 2016, 5:35pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/7 "2016-02-11T17:35:02Z")

</div>

The setting which needs to be set is `http.publish_port`.

`http.port` is used for the bound address and `http.publish_port` for the publish address.

The error message is unfortunately misleading in this case. The reason this check was put in place is that previously, when there were multiple bound addresses (with possibly different ports) and a publish address not matching any of the bound addresses, we would just randomly pick one. Instead of making the fallback logic smarter (which is already pretty complex), we opted to fail fast. With that said, I'll have another look at the code and see how we can better support the Docker scenario.

---

<div class="post-metadata">

**Author:** ![RustyWilson](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RustyWilson](https://discuss.elastic.co/u/RustyWilson)\
**Post date:** [February 23, 2016, 6:37pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/8 "2016-02-23T18:37:08Z")

</div>

First and foremost. This change broke the cardinal rule of "If it ain't broke don't fix it!"

I've lost nearly 3 hours this morning due to this poorly executed and equally poorly publicized[https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-2.2.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-2.2.html) code revision due to a minor version update, which happens automatically during an apt-get update && apt-get upgrade!

I finally got it working by specifying the "_site_" addresses in the network.host setting:

```
network.host: ["_local_","_site_"]
network.publish_host: "<redacted>" # used for all node-to-node communication

```

These are the kinds of things that continuously prevent me from upgrading my critical production environments beyond 1.7.x.

---

<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 23, 2016, 6:46pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/9 "2016-02-23T18:46:20Z")

</div>

Did you jump directly from 1.7 to 2.2? Did you reach the breaking changes for the initial 2.0 release?

---

<div class="post-metadata">

**Author:** ![RustyWilson](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RustyWilson](https://discuss.elastic.co/u/RustyWilson)\
**Post date:** [February 23, 2016, 6:55pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/10 "2016-02-23T18:55:28Z")

</div>

No. My production environment is on 1.7.5.

This is my development build. It was running 2.1

---

<div class="post-metadata">

**Author:** ![schmorgs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/schmorgs/32/39476_2.png) [@schmorgs](https://discuss.elastic.co/u/schmorgs)\
**Post date:** [March 1, 2016, 8:57am UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/11 "2016-03-01T08:57:26Z")

</div>

Just a quick update, I got this working by using the following parameters in my elasticsearch.yml file

```auto
network.host: "myhostname"
http.bind_host: 127.0.0.1
http.publish_port: 9200
http.port: 9200

```

This limits incoming HTTP requests to local host, but allows the node to discover and connect to other nodes in the cluster. Not a totally secure solution, I know, but it at least brings us back to where we were and allows us to update to 2.2.0

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [March 1, 2016, 4:54pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/12 "2016-03-01T16:54:41Z")

</div>

@schmorgs just adding `http.publish_port` to your initial config should do the trick, e.g.

```auto
network.bind_host: 127.0.0.1
network.publish_host: myhostname
transport.bind_host: myhostname
http.publish_port: 9200

```

---

<div class="post-metadata">

**Author:** ![Ahmed\_Azza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmed_azza/32/16403_2.png) [@Ahmed\_Azza](https://discuss.elastic.co/u/Ahmed_Azza)\
**Post date:** [March 16, 2017, 8:36am UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/13 "2017-03-16T08:36:34Z")

</div>

I had the same problem and i resolved it with your Config. Thanks  
The problem was that ES gives automatically an other bind\_host adresse, because i didn't configure it  
network.host: "192.168.1.40"  
http.bind\_host: 127.0.0.1  
http.publish\_port: 9200  
http.port: 9200  
now i got the two nodes in the cluster (y)

---

<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, 10:02pm UTC](https://discuss.elastic.co/t/upgrading-to-es-2-2-0-doesnt-allow-node-to-have-different-bind-and-publish-addresses/41290/14 "2017-07-05T22:02:11Z")

</div>


