# Failed to connect to master

**URL:** <https://discuss.elastic.co/t/failed-to-connect-to-master/33597>\
**Category:** Logstash\
**Created:** [November 3, 2015, 6:30am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597 "2015-11-03T06:30:10Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![zpp](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@zpp](https://discuss.elastic.co/u/zpp)\
**Post date:** [November 3, 2015, 6:30am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/1 "2015-11-03T06:30:10Z")

</div>

Hi,

Our logstash(indexer) recently encountered below error frequently, what is this error and how can we fix it?

Nov 03, 2015 2:00:25 PM org.elasticsearch.discovery.zen.ZenDiscovery joinElectedMaster  
WARNING: [logstash-ELKServerName-24033-11634] failed to connect to master [[ELKServerName][an-1G0IpRja1urW2OD4jxw]...  
org.elasticsearch.transport.ConnectTransportException: [ELKServerName][inet[/ELKServerIP:9300]] connect\_timeout[  
at org.elasticsearch.transport.netty.NettyTransport.connectToChannels(NettyTransport.java:825)  
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:758)  
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:731)  
at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:216)  
at org.elasticsearch.discovery.zen.ZenDiscovery.joinElectedMaster(ZenDiscovery.java:465)  
at org.elasticsearch.discovery.zen.ZenDiscovery.innerJoinCluster(ZenDiscovery.java:417)  
at org.elasticsearch.discovery.zen.ZenDiscovery.access$6100(ZenDiscovery.java:86)  
at org.elasticsearch.discovery.zen.ZenDiscovery$JoinThreadControl$1.run(ZenDiscovery.java:1384)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)

redis, logstash(indexer) and elasticsearch run on the same server, and it's a single node cluster.  
logstash: 1.5.2  
elasticsearch:1.7.2

---

<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:** [November 3, 2015, 6:45am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/2 "2015-11-03T06:45:00Z")

</div>

Try switching to the HTTP protocol and you should be ok 🙂

---

<div class="post-metadata">

**Author:** ![zpp](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@zpp](https://discuss.elastic.co/u/zpp)\
**Post date:** [November 3, 2015, 6:55am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/3 "2015-11-03T06:55:08Z")

</div>

are you referring to configuring indexer's elasticsearch output plugin to use protocol =\> "http"?

---

<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:** [November 3, 2015, 6:55am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/4 "2015-11-03T06:55:44Z")

</div>

Yep! 🙂

---

<div class="post-metadata">

**Author:** ![zpp](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@zpp](https://discuss.elastic.co/u/zpp)\
**Post date:** [November 3, 2015, 6:57am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/5 "2015-11-03T06:57:14Z")

</div>

thank you very much! let me try it~~

---

<div class="post-metadata">

**Author:** ![zpp](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@zpp](https://discuss.elastic.co/u/zpp)\
**Post date:** [November 3, 2015, 7:07am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/6 "2015-11-03T07:07:53Z")

</div>

I still encounter the same error after changing to http protocol ☹  
output {  
elasticsearch {  
cluster =\> "clustername"  
protocol =\> "http"  
index =\> "test-%{+YYYY.MM.dd}"  
workers =\> 4  
}  
}

---

<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:** [November 3, 2015, 7:10am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/7 "2015-11-03T07:10:33Z")

</div>

You need to remove `cluster` and put in `host`, check out [https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html)

---

<div class="post-metadata">

**Author:** ![zpp](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@zpp](https://discuss.elastic.co/u/zpp)\
**Post date:** [November 3, 2015, 7:31am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/8 "2015-11-03T07:31:37Z")

</div>

I tried with below option but still failed. with the doc, i'm not sure whether i need to configure the host to host =\> "ip:9200", but anyway i tried both options, but both still came back with errors  
output {  
elasticsearch {  
protocol =\> "http"  
host =\> "xxx.xxx.xxx.xxx"  
index =\> "test-%{+YYYY.MM.dd}"  
workers =\> 4  
}  
}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 3, 2015, 9:18am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/9 "2015-11-03T09:18:50Z")

</div>

> I tried with below option but still failed

How? If you made the configuration change you claimed to have made you must have received a different error message.

---

<div class="post-metadata">

**Author:** ![zpp](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@zpp](https://discuss.elastic.co/u/zpp)\
**Post date:** [November 3, 2015, 10:09am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/10 "2015-11-03T10:09:56Z")

</div>

i've actually compared the error message, and to my surprise, they are the same.  
output {  
elasticsearch {  
protocol =\> "http"  
host =\> "xxx.xxx.xxx.xxx"  
index =\> "test-%{+YYYY.MM.dd}"  
workers =\> 4  
}  
}

output {  
elasticsearch {  
protocol =\> "http"  
host =\> "xxx.xxx.xxx.xxx:9200"  
index =\> "test-%{+YYYY.MM.dd}"  
workers =\> 4  
}  
}

---

<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:** [November 3, 2015, 10:10am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/11 "2015-11-03T10:10:38Z")

</div>

Then your config is wrong, can we see the entire thing?

---

<div class="post-metadata">

**Author:** ![zpp](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@zpp](https://discuss.elastic.co/u/zpp)\
**Post date:** [November 3, 2015, 10:20am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/12 "2015-11-03T10:20:07Z")

</div>

which part of the configuration you would like to see?  
the interesting thing is that the whole log ingestion was working fine for about 2 weeks, then the above error started to surface when we added in more logs along the way

---

<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:** [November 3, 2015, 10:20am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/13 "2015-11-03T10:20:41Z")

</div>

The whole thing would help.

---

<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 6, 2017, 5:24am UTC](https://discuss.elastic.co/t/failed-to-connect-to-master/33597/14 "2017-07-06T05:24:20Z")

</div>


