Kibana try connect to port 9200 instead the default protocol port (80 or 443)


We're using ES6.2.4 stack over mesos platform.
We use marathon and marathon-lb (GitHub - mesosphere/marathon-lb: Marathon-lb is a service discovery & load balancing tool for DC/OS) project in order to orchestrate and publish ES624 cross search instances and using official ES docker images.

Elasticsearch Cross Search is registered to Marathon-LB with this settings:

"labels": {
"HAPROXY_0_VHOST": "elasticsearch-cross-search.SUFFIXDNS"

Kibana service is launched setting this environment variable:

ELASTICSEARCH_URL": "http://elasticsearch-cross-search.SEFFIXDNS",

It seems a simple configuration but this is not working fine, in fact, Kibana can not connect to ES.

{"type":"log","@timestamp":"2018-05-20T06:41:22Z","tags":["status","plugin:elasticsearch@6.2.4","info"],"pid":15,"state":"yellow","message":"Status changed from uninitialized to yellow - Waiting for Elasticsearch","prevState":"uninitialized","prevMsg":"uninitialized"}
{"type":"log","@timestamp":"2018-05-20T06:41:22Z","tags":["error","elasticsearch","admin"],"pid":15,"message":"Request error, retrying\nHEAD http://elasticsearch-cross-search.SUFFIXDNS:9200/ => connect ECONNREFUSED 10.B.C.D:9200"}
{"type":"log","@timestamp":"2018-05-20T06:41:22Z","tags":["warning","elasticsearch","admin"],"pid":15,"message":"Unable to revive connection: http://elasticsearch-cross-search.SUFFIXDNS:9200/"}
{"type":"log","@timestamp":"2018-05-20T06:41:22Z","tags":["warning","elasticsearch","admin"],"pid":15,"message":"No living connections"}
{"type":"log","@timestamp":"2018-05-20T06:41:22Z","tags":["status","plugin:elasticsearch@6.2.4","error"],"pid":15,"state":"red","message":"Status changed from yellow to red - Unable to connect to Elasticsearch at http://elasticsearch-cross-search.SUFFIXDNS.","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}

The first step was modify ELASTICSEARCH_URL environment using IP and PORT of ES instance and it was working fine.
This is not working well due to the published port by elasticsearch is 9200 instead 80
The fix has been specify the port in ELASTICSEARCH_URL environment variable.

ELASTICSEARCH_URL": "http://elasticsearch-cross-search.SUFFIXDNS:80",

Kibana traces was these

{"type":"log","@timestamp":"2018-05-20T07:10:02Z","tags":["status","plugin:elasticsearch@6.2.4","info"],"pid":15,"state":"yellow","message":"Status changed from uninitialized to yellow - Waiting for Elasticsearch","prevState":"uninitialized","prevMsg":"uninitialized"}
{"type":"log","@timestamp":"2018-05-20T07:10:02Z","tags":["status","plugin:elasticsearch@6.2.4","info"],"pid":15,"state":"green","message":"Status changed from yellow to green - Ready","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}

I think Kibana should modify the code in order to use the default ports from the protocol instead the port 9200

I disagree. Given that Elasticsearch by default binds to port 9200 and can not be run as root (which makes binding ton port 80 difficult), having 9200 as default value makes perfect sense.

I think kibana such as anothers http applications should respect RFC 1738 - Uniform Resource Locators (URL).

    The port number to connect to. Most schemes designate
    protocols that have a default port number. Another port number
    may optionally be supplied, in decimal, separated from the
    host by a colon. If the port is omitted, the colon is as well.

If another port number is optional, then the applications should respect the ports designate by schemes.
This is just one opinion.

1 Like

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