0

I have my ES 2.2 installed on my digital ocean droplet.My ES config file looks like below

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
 network.host: "My Droplet Ip address"
 network.bind_host: 127.0.0.1
 http.publish_port: 9200
 http.port: 9200
#
# 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>
#
# http.cors.enabled: true
#http.cors.allow-origin: "*"

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

Now when I try to curl -XGET localhost:9200 it works properly but when I try to access my ES from remote "http://IpAddress:9200 is gives me CONNECTION REFUSED also curl -XGET IPAddress:9200 gives me CONNECTION REFUSED

This was working fine with ES 1.4 but with 2.X it has started to give me connection problems

arpit joshi
  • 1,987
  • 8
  • 36
  • 62

1 Answers1

1

You have two solutions:

A. You can change network.bind_host to your public IP address

B. You remove network.bind_host and only keep network.host with your public IP address. The latter will set both network.bind_host and network.publish_host to your public IP address.

Also make sure to remove all spaces at the beginning of your lines.

Val
  • 207,596
  • 13
  • 358
  • 360
  • Now Its working but when I add below http.cors.enabled:true and http.cors.allowed.origin:"*" ES does not restart Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: expected , but found BlockMappingStart Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: in 'reader', line 67, column 3: Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: http.cors.enabled: true Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: ^ – arpit joshi Mar 11 '16 at 05:13
  • You should preferably update your question with the trace you're getting, it's easier to read than in comments. – Val Mar 11 '16 at 05:14