# Kibana Setting multiple elasticsearch.hosts over marathon template

**URL:** <https://discuss.elastic.co/t/kibana-setting-multiple-elasticsearch-hosts-over-marathon-template/202662>\
**Category:** Kibana\
**Created:** [October 8, 2019, 12:04pm UTC](https://discuss.elastic.co/t/kibana-setting-multiple-elasticsearch-hosts-over-marathon-template/202662 "2019-10-08T12:04:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Merlin\_Nunez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/merlin_nunez/32/58551_2.png) [@Merlin\_Nunez](https://discuss.elastic.co/u/Merlin_Nunez)\
**Post date:** [October 8, 2019, 12:04pm UTC](https://discuss.elastic.co/t/kibana-setting-multiple-elasticsearch-hosts-over-marathon-template/202662/1 "2019-10-08T12:04:59Z")

</div>

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 Elasticsearch 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.99:9200), [http://99.9.99.98:9200](http://99.9.99.98:9200)"  
> "[[http://99.9.99.99:9200](http://99.9.99.99:9200), [http://99.9.99.98:9200](http://99.9.99.98:9200)]"  
> ""[[http://99.9.99.99:9200](http://99.9.99.99:9200)", "[http://99.9.99.98: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!

---

<div class="post-metadata">

**Author:** ![tiagocosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagocosta/32/40045_2.png) [@tiagocosta](https://discuss.elastic.co/u/tiagocosta)\
**Post date:** [October 8, 2019, 2:28pm UTC](https://discuss.elastic.co/t/kibana-setting-multiple-elasticsearch-hosts-over-marathon-template/202662/2 "2019-10-08T14:28:23Z")

</div>

@Merlin_Nunez could you please try the following

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

```

Cheers

---

<div class="post-metadata">

**Author:** ![Merlin\_Nunez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/merlin_nunez/32/58551_2.png) [@Merlin\_Nunez](https://discuss.elastic.co/u/Merlin_Nunez)\
**Post date:** [October 8, 2019, 3:24pm UTC](https://discuss.elastic.co/t/kibana-setting-multiple-elasticsearch-hosts-over-marathon-template/202662/3 "2019-10-08T15:24:36Z")

</div>

> [@tiagocosta](#):
>
> '["[http://99.9.99.99:9200](http://99.9.99.99:9200)","[http://99.9.99.98:9200](http://99.9.99.98:9200)"]'

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

---

<div class="post-metadata">

**Author:** ![tiagocosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagocosta/32/40045_2.png) [@tiagocosta](https://discuss.elastic.co/u/tiagocosta)\
**Post date:** [October 8, 2019, 3:32pm UTC](https://discuss.elastic.co/t/kibana-setting-multiple-elasticsearch-hosts-over-marathon-template/202662/4 "2019-10-08T15:32:01Z")

</div>

@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:

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

```

or

```auto
"[\\\"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

---

<div class="post-metadata">

**Author:** ![Merlin\_Nunez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/merlin_nunez/32/58551_2.png) [@Merlin\_Nunez](https://discuss.elastic.co/u/Merlin_Nunez)\
**Post date:** [October 8, 2019, 3:41pm UTC](https://discuss.elastic.co/t/kibana-setting-multiple-elasticsearch-hosts-over-marathon-template/202662/5 "2019-10-08T15:41:57Z")

</div>

> "["[http://99.9.99.99:9200](http://99.9.99.99:9200)","[http://99.9.99.98: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!

---

<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:** [November 5, 2019, 3:42pm UTC](https://discuss.elastic.co/t/kibana-setting-multiple-elasticsearch-hosts-over-marathon-template/202662/6 "2019-11-05T15:42:00Z")

</div>

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