Kibana Setting multiple elasticsearch.hosts over marathon template

Hi All,

I´m currently running ELK in a dockerized environment, and I use marathon/mesos to manage it. Up until now I was running a single node cluster but it is obviously not fit for production. So, my goal is to set up a two node cluster, with two elasticsearch nodes and a kibana client capable of using them both.
right now im setting in kibana the url of elasticsearch like this:

                "env": {
                    "ELASTICSEARCH_HOSTS": "http://99.9.99.99:9200"
                },

I need to add a second url for another elastic search node. So far I´ve tried all combinations that I could think of and none of them work, like:

"http://99.9.99.99:9200, http://99.9.99.98:9200"
"[http://99.9.99.99:9200, http://99.9.99.98:9200]"
""[http://99.9.99.99:9200", "http://99.9.99.98:9200"]"

But I always get the same error:

{"type":"log","@timestamp":"2019-10-07T19:37:34Z","tags":["fatal","root"],"pid":1,"message":"{ ValidationError: child "elasticsearch" fails because [child "hosts" fails because [single value of "hosts" fails because ["hosts" must be a valid uri with a scheme matching the http|https pattern]]]\n at Object.exports.process (/usr/share/kibana/node_modules/joi/lib/errors.js:196:19)\n at internals.Object._validateWithOptions (/usr/share/kibana/node_modules/joi/lib/types/any/index.js:675:31)\n at module.exports.internals.Any.root.validate (/usr/share/kibana/node_modules/joi/lib/index.js:146:23)\n at Config._commit (/usr/share/kibana/src/legacy/server/config/config.js:139:35)\n at Config.set (/usr/share/kibana/src/legacy/server/config/config.js:108:10)\n at Config.extendSchema (/usr/share/kibana/src/legacy/server/config/config.js:81:10)\n at extendConfigService (/usr/share/kibana/src/legacy/plugin_discovery/plugin_config/extend_config_service.js:45:10) name: 'ValidationError' }"}

I´m trying to avoid having a custom bind kibana.yml since this complicates deployment, so it would be very usefull to find a way of having this working using an external property.

Thanks in advance!

@Merlin_Nunez could you please try the following

"env": {
    "ELASTICSEARCH_HOSTS": '["http://99.9.99.99:9200","http://99.9.99.98:9200"]'
},

Cheers

Oddly enough, that format works when I work with docker compose, but not when I work with marathon, i still get the same error.

@Merlin_Nunez I'm not familiar with marathon, but my first thought then is maybe you need to escape the string and write something like:

"[\"http://99.9.99.99:9200\",\"http://99.9.99.98:9200\"]"

or

"[\\\"http://99.9.99.99:9200\\\",\\\"http://99.9.99.98:9200\\\"]"

The last one I'm suggesting is because in quick search I ran, looks like an user reported in the marathon repo that he was having problems escaping the string and he was only successful that way.

Cheers

"["http://99.9.99.99:9200","http://99.9.99.98:9200"]"

That one somehow works!, I could swear I tried that before, must be going crazy for all the trial and error!.
Thank you so much @tiagoacosta!

1 Like

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