I have a elasticsearch 7.6.1 docker container which i want to run on port 9400,9500 port.
This is the docker run command I have used.
docker run -d --name elasticsearch761v2 -v /data/dump/:/usr/share/elasticsearch/data
-p 9400:9400 -p 9500:9500 -e "discovery.type=single-node" elasticsearch:7.6.1
Which gives the below output.
docker ps -a | grep elastic
idofcontainer elasticsearch:7.6.1 "/usr/local/bin/docke" 18 minutes ago Up 4 minutes
9200/tcp, 0.0.0.0:9400->9400/tcp, 9300/tcp, 0.0.0.0:9500->9500/tcp elasticsearch761v2
I have also set the elasticsearch.yml setting to below.
[root@idofcontainer config]# vi elasticsearch.yml
cluster.name: "docker-cluster"
network.host: 0.0.0.0
transport.tcp.port: 9400
I have added Iptable entry for the above ports too.
The log for this container is :-
{"type": "server", "timestamp": "2020-04-06T08:25:22,684Z", "level": "INFO", "component": "o.e.c.r.a.AllocationService", "cluster.name": "docker-cluster", "node.name": "4196b5b23",
"message": "Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[.kibana_task_manager_1][0], [.kibana_1][0]]]).", "cluster.uuid": "gx7s8R_PTUK4lFPPGBZA", "node.id": "XfLZnNNnQnAOHJnWdDQg" }
The Curl output is this :-
curl http://eserver:9400/_cat
This is not an HTTP port
Because of this, my kibana is also not able to reach the ES server. I have set the kibana.yml to point to the above port.
Kibana.yml
# Default Kibana configuration for docker target
server.name: kibana
server.host: "0"
elasticsearch.hosts: ["http://eserver:9400/"]
xpack.monitoring.ui.container.elasticsearch.enabled: true
The log of this kibana container.
{"type":"log","@timestamp":"2020-04-06T08:49:14Z","tags":["warning","elasticsearch","admin"],"pid":7,"message":"Unable to revive connection: http://eserver:9400/"}
{"type":"log","@timestamp":"2020-04-06T08:49:14Z","tags":["warning","elasticsearch","admin"],"pid":7,"message":"No living connections"}
You have defined custom transport port 9400
and using it as HTTP port in your curl
command to check the Elastic server, which error message is clearly pointing.
This is not an HTTP port
As you mentioned, you want to run your Elastic on 9400 and 9500, then you need to properly bind the default HTTP port 9200 to 9500, using below command.
docker run -d --name elasticsearch761v2 -v /data/dump/:/usr/share/elasticsearch/data
-p 9400:9400 -p 9500:9200 -e "discovery.type=single-node" elasticsearch:7.6.1
Note the only change required is -p 9500:9200
and after that, you can check your ES server using curl http://eserver:9500
, ie using HTTP port.