# Elasticsearch connectin refused

**URL:** <https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876>\
**Category:** Elasticsearch\
**Created:** [October 24, 2018, 9:41pm UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876 "2018-10-24T21:41:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hitardha](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hitardha](https://discuss.elastic.co/u/hitardha)\
**Post date:** [October 24, 2018, 9:41pm UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/1 "2018-10-24T21:41:21Z")

</div>

Hi,

I have installed elasticsearch But when i am trying to run curl it is resulting to the error "connection refused" following are the few observations.

If i configure network.host to localhost in elasticsearch.yml it is working fine and netstat -tupln | grep java shows 127.0.0.1:9200 and 127.0.0.1:9300

If i configure http.host to FQDN in elasticsearch.yml curl fails and netstat shows only 127.0.0.1:9300

If I configure network.host to FQDN in elasticsearch.yml curl fails and netstat shows nothing related to elasticsearch

Please help to sort this out. How can i restrict curl avoiding go through external proxy and external firewall ?

Hitardha

---

<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:** [October 24, 2018, 9:57pm UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/2 "2018-10-24T21:57:40Z")

</div>

> [@hitardha](#):
>
> Please help to sort this out. How can i restrict curl avoiding go through external proxy and external firewall ?

You need to speak to your network admin about that.

> [@hitardha](#):
>
> If i configure http.host to FQDN in elasticsearch.yml curl fails and netstat shows only 127.0.0.1:9300
> 
> If I configure network.host to FQDN in elasticsearch.yml curl fails and netstat shows nothing related to elasticsearch

Please show the config you used as well as the logs.

---

<div class="post-metadata">

**Author:** ![hitardha](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hitardha](https://discuss.elastic.co/u/hitardha)\
**Post date:** [October 25, 2018, 3:19am UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/3 "2018-10-25T03:19:00Z")

</div>

```
[root@PHCHBS-ST290005 ~]# cat /etc/elasticsearch/elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: DVNC
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /CHBS/data/ELK/es/Data
#
# Path to log files:
#
path.logs: /CHBS/data/ELK/es/Logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: phchbs-sd220166.eu.novartis.net
#network.host: '_team0_'
#network.bind_host: '_team0_'
http.host: phchbs-sd220166.eu.novartis.net
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes:
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
[root@PHCHBS-ST290005 ~]#
```

---

<div class="post-metadata">

**Author:** ![hitardha](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hitardha](https://discuss.elastic.co/u/hitardha)\
**Post date:** [October 25, 2018, 3:20am UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/4 "2018-10-25T03:20:24Z")

</div>

```
[root@PHCHBS-ST290005 ~]# tail -50 /CHBS/data/ELK/es/Logs/DVNC.log
        at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1283) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:989) ~[?:?]
        at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254) ~[?:?]
        at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:365) ~[?:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[?:?]
        at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_181]
[2018-10-24T23:36:29,158][WARN][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: BindHttpException[Failed to bind to [9200]]; nested: BindException[Cannot assign requested address];
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.4.1.jar:6.4.1]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.4.1.jar:6.4.1]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.4.1.jar:6.4.1]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.4.1.jar:6.4.1]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.4.1.jar:6.4.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.4.1.jar:6.4.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.4.1.jar:6.4.1]
Caused by: org.elasticsearch.http.BindHttpException: Failed to bind to [9200]
        at org.elasticsearch.http.netty4.Netty4HttpServerTransport.bindAddress(Netty4HttpServerTransport.java:474) ~[?:?]
        at org.elasticsearch.http.netty4.Netty4HttpServerTransport.createBoundHttpAddress(Netty4HttpServerTransport.java:375) ~[?:?]
        at org.elasticsearch.http.netty4.Netty4HttpServerTransport.doStart(Netty4HttpServerTransport.java:352) ~[?:?]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:66) ~[elasticsearch-6.4.1.jar:6.4.1]
        at org.elasticsearch.node.Node.start(Node.java:734) ~[elasticsearch-6.4.1.jar:6.4.1]
        at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:265) ~[elasticsearch-6.4.1.jar:6.4.1]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:335) ~[elasticsearch-6.4.1.jar:6.4.1]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.4.1.jar:6.4.1]
        ... 6 more
Caused by: java.net.BindException: Cannot assign requested address
        at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
        at sun.nio.ch.Net.bind(Net.java:433) ~[?:?]
        at sun.nio.ch.Net.bind(Net.java:425) ~[?:?]
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:?]
        at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128) ~[?:?]
        at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:558) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1283) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:989) ~[?:?]
        at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254) ~[?:?]
        at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:365) ~[?:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[?:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
[2018-10-24T23:36:29,165][INFO][o.e.g.GatewayService] [node-1] recovered [0] indices into cluster_state
[2018-10-24T23:36:30,129][INFO][t.b.r.e.SettingsObservableImpl] [CLUSTERWIDE SETTINGS] index settings not found. Will keep on using the local YAML file. Learn more about clusterwide settings at https://readonlyrest.com/pro.html
[root@PHCHBS-ST290005 ~]#
```

---

<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:** [October 25, 2018, 4:18am UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/5 "2018-10-25T04:18:06Z")

</div>

Please edit your post and use the `</>` button to format the config and logs. Otherwise use markdown style back ticks.

---

<div class="post-metadata">

**Author:** ![hitardha](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hitardha](https://discuss.elastic.co/u/hitardha)\
**Post date:** [October 25, 2018, 10:38am UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/6 "2018-10-25T10:38:06Z")

</div>

Please help me to sort this issue.

---

<div class="post-metadata">

**Author:** ![Admin\_Hack](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Admin\_Hack](https://discuss.elastic.co/u/Admin_Hack)\
**Post date:** [October 25, 2018, 12:17pm UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/7 "2018-10-25T12:17:44Z")

</div>

use `sudo ufw allow 9200` if not works then sudo apt-get purge elasticsearch .  
[EDITED] Then use yum remove package-name instead of apt-get  
SEE here [Follow this tut](https://unix.stackexchange.com/questions/120176/cannot-connect-centos-on-port-9200)

---

<div class="post-metadata">

**Author:** ![hitardha](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hitardha](https://discuss.elastic.co/u/hitardha)\
**Post date:** [October 25, 2018, 12:26pm UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/8 "2018-10-25T12:26:25Z")

</div>

My server environment is RHEL not Ubuntu .. still works ?

---

<div class="post-metadata">

**Author:** ![Tek\_Chand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tek_chand/32/34318_2.png) [@Tek\_Chand](https://discuss.elastic.co/u/Tek_Chand)\
**Post date:** [October 26, 2018, 8:55am UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/9 "2018-10-26T08:55:29Z")

</div>

@hitardha, Can you please try to ping your FQDN i.e `node-1`? Its seems that you can't ping it. So please use IP of your node in `elasticseerach.yml` file. Then restart the service of elasticserach. Please let me know if you face any issue.

Thanks.

---

<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 23, 2018, 8:55am UTC](https://discuss.elastic.co/t/elasticsearch-connectin-refused/153876/10 "2018-11-23T08:55:30Z")

</div>

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