# Connection errors if not "localhost" used

**URL:** <https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905>\
**Category:** Elasticsearch\
**Created:** [May 25, 2016, 5:42am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905 "2016-05-25T05:42:32Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [May 25, 2016, 5:42am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/1 "2016-05-25T05:42:32Z")

</div>

I have installed ELK tools and also packetbeat and topbeat

When I configure them to send logs through localhost; there is no errors. However, when I typed the exact ip address of my machine, error pops out.

> 16/05/25 05:34:49.972415 single.go:126: INFO Connecting error publishing events (retrying): Head [http://172.16.1.245:9200](http://172.16.1.245:9200): dial tcp 172.16.1.245:9200: getsockopt: connection refused  
> 2016/05/25 05:34:49.972442 single.go:152: INFO send fail  
> 2016/05/25 05:34:49.972456 single.go:159: INFO backoff retry: 2s

Anyone have any ideas to resolve it?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2016, 5:47am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/2 "2016-05-25T05:47:32Z")

</div>

What does SSL have to do with this then?

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [May 25, 2016, 5:51am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/3 "2016-05-25T05:51:21Z")

</div>

When I use another machine to send to my server, it comes with another sentence, stating

> 16/05/25 05:34:49.972415 single.go:126: INFO Connecting error publishing events (retrying): Head [http://172.16.1.245:9200](http://172.16.1.245:9200): dial tcp 172.16.1.245:9200: getsockopt: connection refused  
> 2016/05/25 05:34:49.972442 single.go:152: INFO send fail  
> 2016/05/25 05:34:49.972456 single.go:159: INFO backoff retry: 2s

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2016, 5:52am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/4 "2016-05-25T05:52:17Z")

</div>

That's the same thing as your first bit of logs?

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [May 25, 2016, 5:57am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/5 "2016-05-25T05:57:21Z")

</div>

Maybe this will be clear.

I have two machines.

1. ELK server
2. client

When configuring beats file (topbeat.yml) to use elasticsearch as output and the host as localhost:9200, then everything is smooth without error. However, when I turn localhost:9200 to 172.16.1.221:9200, the first pile of errors come out

Then when I set up topbeat.yml in the client using elasticsearch as output and the host as 172.16.1.221:9200, the second pile of error comes out

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2016, 5:59am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/6 "2016-05-25T05:59:45Z")

</div>

Ahh I can see you have update the topic, now it makes more sense!

Can you contact ES via `172.16.1.221:9200` from the host that filebeat is running on?

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [May 25, 2016, 6:17am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/7 "2016-05-25T06:17:52Z")

</div>

I didnt run on any filebeat  
Is it a must to run filebeat

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2016, 7:20am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/8 "2016-05-25T07:20:30Z")

</div>

Sorry, packetbeat or topbeat.

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [May 25, 2016, 7:21am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/9 "2016-05-25T07:21:44Z")

</div>

How to check if it is contacting the ES? I can only see the beats are reading logs when I run the yml with - "publish"

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2016, 7:22am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/10 "2016-05-25T07:22:12Z")

</div>

Use telnet to see if it can connect.

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [May 25, 2016, 7:26am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/11 "2016-05-25T07:26:15Z")

</div>

No, it says connection refused when telnet IP 9200

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2016, 7:54am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/12 "2016-05-25T07:54:59Z")

</div>

Do you have ES listening to that `172.16.1.221` IP? What's in your config?

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [May 25, 2016, 8:27am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/13 "2016-05-25T08:27:46Z")

</div>

Oh I have changed the elasticsearch.yml networkhost to 0.0.0.0  
then everything is ok now  
What's the reason though

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2016, 8:29am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/14 "2016-05-25T08:29:02Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-network.html#modules-network](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-network.html#modules-network)

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [May 25, 2016, 8:40am UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/15 "2016-05-25T08:40:42Z")

</div>

Thanks for the guide. Great Thx.  
I have come across another problem, not sure you have any ideas about it?  
[https://discuss.elastic.co/t/read-files-from-another-machine/50922?u=kennedy\_kan1](https://discuss.elastic.co/t/read-files-from-another-machine/50922?u=kennedy_kan1)

---

<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:** [July 5, 2017, 10:49pm UTC](https://discuss.elastic.co/t/connection-errors-if-not-localhost-used/50905/16 "2017-07-05T22:49:11Z")

</div>


