# Fleet hosts settings

**URL:** https://discuss.elastic.co/t/fleet-hosts-settings/324821
**Category:** Elastic Agent
**Created:** [February 6, 2023, 6:27pm UTC](https://discuss.elastic.co/t/fleet-hosts-settings/324821 "2023-02-06T18:27:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adrien\_moreau](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adrien_moreau/32/101590_2.png) [@adrien\_moreau](https://discuss.elastic.co/u/adrien_moreau)
#### Post date: [February 6, 2023, 6:27pm UTC](https://discuss.elastic.co/t/fleet-hosts-settings/324821/1 "2023-02-06T18:27:27Z")

</div>

Hello,

I am running elk in a self managed environment and my question concerns the following fleet setting:  
`xpack.fleet.agents.elasticsearch.hosts`

This parameter is described in documentation as:  
"Hostnames used by Elastic Agent for accessing Elasticsearch."

Does it mean that each hostname in the list is a hostname that points to the same Elasticsearch? Or does it mean that each hostname in the list points to a different Elasticsearch.

I have only one Elasticsearch node and it has:

- a public hostname used by elastic-agent that run in other networks as my cluster
- an internal hostname that is used by fleet-server elastic-agent to access it

So I configured my kibana.yml as such:

```auto
xpack.fleet.agents.elasticsearch.hosts:
  - public_hostname
  - intern_hostname

```

Is it the right way do go?

I have the same question with `xpack.fleet.agents.fleet_server.hosts`

---

<div class="post-metadata">

### Author: ![Shaoranlaos](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@Shaoranlaos](https://discuss.elastic.co/u/Shaoranlaos)
#### Post date: [February 7, 2023, 7:20am UTC](https://discuss.elastic.co/t/fleet-hosts-settings/324821/2 "2023-02-07T07:20:18Z")

</div>

The \*.hosts config options define the nodes in a cluster the agent could connect to.  
It will try each one until it finds one it can connect to.  
So in your case you probably should only have your public hostname in there.

The same goes for the fleet\_servers. You would enter all fleet-hosts (including port) that you have and the agent will try all of them until it finds one it can connect to.

I belive there is also a random selection at work, so the agent doesn't always start its connection tries from the top of the listed hosts.

---

<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: [March 7, 2023, 7:21am UTC](https://discuss.elastic.co/t/fleet-hosts-settings/324821/3 "2023-03-07T07:21:01Z")

</div>

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