Curl: (7) Failed connect to 193.81.62.189:9200; Connection refused

Hi,
I installed ES 5.0. on my server(centos 7). I want to work on server not localhost. So I changed my elasticsearch.yml file with my ip number:193.81.62.189:

network.host: 193.81.62.189

After restart ES and I tried to connection.

However It didn't work true.

curl http://193.81.62.189:9200

my error:
curl: (7) Failed connect to 193.81.62.189:9200; Connection refused

What is the problem????

5.0 is quite an old version. If this is a new install, you would be better of installing a newer version such as 5.4.0 or 5.3.2.

Are you sure that elasticsearch started correctly?

Check the elasticsearch.log file and see what it says.
It is quite possible that you have triggered some bootstrap checks that are applied automatically when you set the network host to an external interface.

Hi Tim

Thanks for reply!!!!

I am attaching my log file here

-sh-4.2$ tail -f /var/log/elasticsearch/elasticsearch.log
[2017-05-12 14:47:23,826][INFO ][node                     ] [h6gY7iy] starting ...
[2017-05-12 14:47:24,042][INFO ][transport                ] [h6gY7iy] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-05-12 14:47:24,048][WARN ][bootstrap                ] [h6gY7iy] initial heap size [268435456] not equal to maximum heap size [2147483648]; this can cause resize pauses and prevents mlockall from locking the entire heap
[2017-05-12 14:47:24,048][WARN ][bootstrap                ] [h6gY7iy] please set [discovery.zen.minimum_master_nodes] to a majority of the number of master eligible nodes in your cluster
[2017-05-12 14:47:24,048][WARN ][bootstrap                ] [h6gY7iy] max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
[2017-05-12 14:47:27,170][INFO ][cluster.service          ] [h6gY7iy] new_master {h6gY7iy}{h6gY7iyeSw2bXA6HoMCSvA}{n3Jeyl5VQ_2enaPXQY8WbQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-05-12 14:47:27,184][INFO ][http                     ] [h6gY7iy] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-05-12 14:47:27,184][INFO ][node                     ] [h6gY7iy] started
[2017-05-12 14:47:27,426][INFO ][gateway                  ] [h6gY7iy] recovered [1] indices into cluster_state
[2017-05-12 14:47:27,701][INFO ][cluster.routing.allocation] [h6gY7iy] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[twitter][4]] ...]).
-------------------------------------------------------------------------------------------------

this is my elasticsearch.yml file

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
# cluster.name:my.application

#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#

# node.name: qa-data

#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /var/data/elasticsearch


# Path to log files:
#
# path.logs: /var/logs/elasticsearch

# ----------------------------------- 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:193.81.62.189

# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# --------------------------------- 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: ["193.81.62.189:9200"]

# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
  discovery.zen.minimum_master_nodes: 3

# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#


 ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true
# network.host:193.81.62.189

That is a YAML comment.
In order to actually set the host that you are binding to, you need to remove the leading #.

I have tried by removing # also but still getting the same error

You need to check your logs again, you are now probably failing these bootstrap checks:

[2017-05-12 14:47:24,048][WARN ][bootstrap                ] [h6gY7iy] please set [discovery.zen.minimum_master_nodes] to a majority of the number of master eligible nodes in your cluster
[2017-05-12 14:47:24,048][WARN ][bootstrap                ] [h6gY7iy] max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

Are you sure that you're on 5.0.0 though and not an alpha or a beta release of 5.0.0? I'm almost certain that we removed the first check before releasing 5.0.0.

HI Jasontedor

I have installed the ES 5 alpha version...i uninstalled that version and installed 2.2.1 version but the service is not running

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