How to configure the publish address of elasticsearch 5.0 with CLI flags

I've used elasticsearch 2.0 with start up flags to configure the publish_addres. I need the publish address to be configured, because I want to start elasticsearch in a docker container and access it from outside. So the publish address must be the IP of the docker host, which is in my case 192.168.99.100. I want to access elasticsearch on port 9201.

docker run -d -p 9201:9201 --name elasticsearch_test elasticsearch:5.2-alpine elasticsearch -Enetwork.publish_host="192.168.99.100" -Ehttp.port="9201"

which is like the old command

docker run -d -p 9201:9201 --name elasticsearch_test elasticsearch:2.4.1 elasticsearch -Des.network.publish_host="192.168.99.100" -Des.http.port="9201"

But when I start the container and look into the logs I don't get the publish address 192.168.99.100:9201, but 192.168.99.100:9300 and 172.17.0.2:9201. How can I force elasticsearch to use my combination of address and port?

Thanks in advance

Output of curl -XGET docker.dev:9201/_nodes?pretty

{ "_nodes" : { "total" : 1, "successful" : 1, "failed" : 0 }, "cluster_name" : "elasticsearch", "nodes" : { "BYDksDQMQLOC-F9A9tJCBg" : { "name" : "BYDksDQ", "transport_address" : "192.168.99.100:9300", "host" : "192.168.99.100", "ip" : "192.168.99.100", "version" : "5.2.0", [...] "settings" : { [...] "http" : { "host" : "0.0.0.0", "type" : { "default" : "netty4" }, "port" : "9201" }, "transport" : { "type" : { "default" : "netty4" } }, "network" : { "bind_host" : "0.0.0.0", "publish_host" : "192.168.99.100" } }, "os" : { "refresh_interval_in_millis" : 1000, "name" : "Linux", "arch" : "amd64", "version" : "4.4.43-boot2docker", "available_processors" : 1, "allocated_processors" : 1 }, "process" : { "refresh_interval_in_millis" : 1000, "id" : 1, "mlockall" : false }, [...] "transport" : { "bound_address" : [ "[::]:9300" ], "publish_address" : "192.168.99.100:9300", "profiles" : { } }, "http" : { "bound_address" : [ "[::]:9201" ], "publish_address" : "172.17.0.2:9201", "max_content_length_in_bytes" : 104857600 }, [...] } } }

Hi,

Can you try and set transport.tcp.port and/or transport.publish_port and transport.publish_host. And see if this has any effect.

https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html

1 Like

Thank you very much. That made it. I had to change http.port to transport.publish_port

The following command works as expected

docker run -d -p 9201:9201 --name elasticsearch_test elasticsearch:5.2-alpine elasticsearch -Enetwork.publish_host="192.168.99.100" -Etransport.publish_port="9201"

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