# Failed to connect to backoff(elasticsearch(http://localhost:9200)): Get http://localhost:9200: dial tcp 127.0.0.1:9200: connect: connection refused

**URL:** <https://discuss.elastic.co/t/failed-to-connect-to-backoff-elasticsearch-http-localhost-9200-get-http-localhost-dial-tcp-127-0-0-1-connect-connection-refused/234146>\
**Category:** APM\
**Tags:** server\
**Created:** [May 25, 2020, 11:52am UTC](https://discuss.elastic.co/t/failed-to-connect-to-backoff-elasticsearch-http-localhost-9200-get-http-localhost-dial-tcp-127-0-0-1-connect-connection-refused/234146 "2020-05-25T11:52:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sspr](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sspr](https://discuss.elastic.co/u/sspr)\
**Post date:** [May 25, 2020, 11:52am UTC](https://discuss.elastic.co/t/failed-to-connect-to-backoff-elasticsearch-http-localhost-9200-get-http-localhost-dial-tcp-127-0-0-1-connect-connection-refused/234146/1 "2020-05-25T11:52:43Z")

</div>

Hi All,

I am new ELK user doing POC, and I install Elasticsearch 7.7,Kibana 7.7 in CentOS 7 .  
I changed host to [2.0.X.X] in elasticsearch.yml ,kibana. I am trying to configure APM Server which is throwing issues.

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [May 25, 2020, 12:15pm UTC](https://discuss.elastic.co/t/failed-to-connect-to-backoff-elasticsearch-http-localhost-9200-get-http-localhost-dial-tcp-127-0-0-1-connect-connection-refused/234146/2 "2020-05-25T12:15:28Z")

</div>

Hi @sspr,  
the error message indicates that you didn't change the Elasticsearch host in the APM Server configuration to reflect your setup. You can find detailed information about how to [configure the Elasticsearch output for APM Server](https://www.elastic.co/guide/en/apm/server/current/elasticsearch-output.html#elasticsearch-output). Also have a look at [where to find the configuration files](https://www.elastic.co/guide/en/apm/server/current/directory-layout.html) depending on your installation method.

---

<div class="post-metadata">

**Author:** ![sspr](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sspr](https://discuss.elastic.co/u/sspr)\
**Post date:** [May 25, 2020, 12:26pm UTC](https://discuss.elastic.co/t/failed-to-connect-to-backoff-elasticsearch-http-localhost-9200-get-http-localhost-dial-tcp-127-0-0-1-connect-connection-refused/234146/3 "2020-05-25T12:26:48Z")

</div>

Hi @simitt ,

I have changed the Elasticsearch Host in the APM Server configuration. Here's my APM Yaml File

################################ APM Server ################################

apm-server:

# Defines the host and port the server is listening on. Use "unix:/path/to.sock" to listen on a unix domain socket.

host: "2.0.X.X:8200"

# Maximum permitted size in bytes of a request's header accepted by the server to be processed.

#max\_header\_size: 1048576

# Maximum amount of time to wait for the next incoming request before underlying connection is closed.

#idle\_timeout: 45s

# Maximum permitted duration for reading an entire request.

# #read\_timeout: 30s

#============================= Elastic Cloud =============================

# These settings simplify using APM Server with the Elastic Cloud ([https://cloud.elastic.co/](https://cloud.elastic.co/)).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` option.

# You can find the `cloud.id` in the Elastic Cloud web UI.

#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and

# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.

#cloud.auth:

#================================ Outputs =================================

# Configure the output to use when sending the data collected by apm-server.

#-------------------------- Elasticsearch output --------------------------  
output.elasticsearch:

# Array of hosts to connect to.

# Scheme and port can be left out and will be set to the default (`http` and `9200`).

# In case you specify and additional path, the scheme is required: `http://localhost:9200/path`.

# IPv6 addresses should always be defined as: `https://[2001:db8::1]:9200`.

hosts: ["2.0.X.X:9200"]

# Boolean flag to enable or disable the output module.

#enabled: true

# Set gzip compression level.

#compression\_level: 0

# Protocol - either `http` (default) or `https`.

#protocol: "https"

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [May 25, 2020, 2:06pm UTC](https://discuss.elastic.co/t/failed-to-connect-to-backoff-elasticsearch-http-localhost-9200-get-http-localhost-dial-tcp-127-0-0-1-connect-connection-refused/234146/4 "2020-05-25T14:06:46Z")

</div>

Configuring `output.elasticsearch.hosts` generally sounds right. Since the APM Server seems to ignore the configuration, can you provide some details about how you installed the server and how you are starting it?

---

<div class="post-metadata">

**Author:** ![sspr](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sspr](https://discuss.elastic.co/u/sspr)\
**Post date:** [May 25, 2020, 2:20pm UTC](https://discuss.elastic.co/t/failed-to-connect-to-backoff-elasticsearch-http-localhost-9200-get-http-localhost-dial-tcp-127-0-0-1-connect-connection-refused/234146/5 "2020-05-25T14:20:00Z")

</div>

Thanks its working @simitt i made some space changes in YAML which lead to indentation.

---

<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:** [June 15, 2020, 10:20am UTC](https://discuss.elastic.co/t/failed-to-connect-to-backoff-elasticsearch-http-localhost-9200-get-http-localhost-dial-tcp-127-0-0-1-connect-connection-refused/234146/6 "2020-06-15T10:20:07Z")

</div>

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