Cannot connect to remote ElasticSearch server

transport.host: 10.0.1.4
transport.tcp.port: 9300 
http.port: 9200
network.host: 0.0.0.0

On your local machine try:

curl -XGET http://127.0.0.1:9200
curl -XGET http://localhost:9200

You can also change:

network.host: 0.0.0.0

to

network.host: 10.0.1.4

And restart the node
Note that you won't be able to use localhost or 127.0.0.1 but only 10.0.1.4.

Thanks for your reply. After changing

network.host: 0.0.0.0

to

network.host: 10.0.1.4

I see the following when running curl -XGET http://localhost:9200:

curl: (7) Failed to connect to localhost port 9200: Connection refused

Before that change, I saw the following instead:

{
  "name" : "8F-Edn5",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "x7V8Sr8KTRu8_pNixpjOkQ",
  "version" : {
    "number" : "6.6.2",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "3bd3e59",
    "build_date" : "2019-03-06T15:16:26.864148Z",
    "build_snapshot" : false,
    "lucene_version" : "7.6.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

But what is the output of:

curl -XGET http://10.0.1.4:9200
{
  "name" : "8F-Edn5",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "x7V8Sr8KTRu8_pNixpjOkQ",
  "version" : {
    "number" : "6.6.2",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "3bd3e59",
    "build_date" : "2019-03-06T15:16:26.864148Z",
    "build_snapshot" : false,
    "lucene_version" : "7.6.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

So that's what you wanted right?

I still cannot access the remote server from my local machine, even with the changes.

Just to be clear, when I run the command curl -XGET http://10.0.1.4:9200 from my local machine, I see this:

curl: (7) Failed to connect to 10.0.1.4 port 9200: Timed out

When I run the command curl -XGET http://10.0.1.4:9200 on my remote ES machine itself, I see this:

{
  "name" : "8F-Edn5",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "x7V8Sr8KTRu8_pNixpjOkQ",
  "version" : {
    "number" : "6.6.2",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "3bd3e59",
    "build_date" : "2019-03-06T15:16:26.864148Z",
    "build_snapshot" : false,
    "lucene_version" : "7.6.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

And when I run curl -XGET http://localhost:9200 on my remote ES machine, I also see this:

curl: (7) Failed to connect to 10.0.1.4 port 9200: Timed out

This is after changing

network.host: 0.0.0.0

to

network.host: 10.0.1.4

Can you share the elasticsearch.log file?

I'd like to see this part:

[2019-03-25T11:21:15,774][INFO ][o.e.n.Node               ] [8F-Edn5] starting ...
[2019-03-25T11:21:16,056][INFO ][o.e.t.TransportService   ] [8F-Edn5] publish_address {10.0.1.4:9300}, bound_addresses {10.0.1.4:9300}
[2019-03-25T11:21:16,103][INFO ][o.e.b.BootstrapChecks    ] [8F-Edn5] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2019-03-25T11:21:19,239][INFO ][o.e.c.s.MasterService    ] [8F-Edn5] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{Yjxxs4IuQt2X3q-bnydgMA}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2019-03-25T11:21:19,255][INFO ][o.e.c.s.ClusterApplierService] [8F-Edn5] new_master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{Yjxxs4IuQt2X3q-bnydgMA}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{Yjxxs4IuQt2X3q-bnydgMA}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-03-25T11:21:19,427][INFO ][o.e.h.n.Netty4HttpServerTransport] [8F-Edn5] publish_address {10.0.1.4:9200}, bound_addresses {[::]:9200}
[2019-03-25T11:21:19,458][INFO ][o.e.n.Node               ] [8F-Edn5] started
[2019-03-25T10:30:08,799][INFO ][o.e.t.TransportService   ] [8F-Edn5] publish_address {10.0.1.4:9300}, bound_addresses {10.0.1.4:9300}
[2019-03-25T10:30:08,827][INFO ][o.e.b.BootstrapChecks    ] [8F-Edn5] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2019-03-25T10:30:11,962][INFO ][o.e.c.s.MasterService    ] [8F-Edn5] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{3kJvlHqBTPqhQDIeMrRDng}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2019-03-25T10:30:11,969][INFO ][o.e.c.s.ClusterApplierService] [8F-Edn5] new_master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{3kJvlHqBTPqhQDIeMrRDng}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{3kJvlHqBTPqhQDIeMrRDng}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-03-25T10:30:12,211][INFO ][o.e.h.n.Netty4HttpServerTransport] [8F-Edn5] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2019-03-25T10:30:12,213][INFO ][o.e.n.Node               ] [8F-Edn5] started

The logs you just pasted are happening at 10:30.
The previous logs were at 11:21.

I'm unsure you are sharing the right information.

I have re-started ES. Here is the new log file:

[2019-03-25T11:49:49,803][INFO ][o.e.t.TransportService   ] [8F-Edn5] publish_address {10.0.1.4:9300}, bound_addresses {10.0.1.4:9300}
[2019-03-25T11:49:49,850][INFO ][o.e.b.BootstrapChecks    ] [8F-Edn5] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2019-03-25T11:49:52,986][INFO ][o.e.c.s.MasterService    ] [8F-Edn5] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{tnNEd8H_SI-cEyCEC2DLyg}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2019-03-25T11:49:53,002][INFO ][o.e.c.s.ClusterApplierService] [8F-Edn5] new_master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{tnNEd8H_SI-cEyCEC2DLyg}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {8F-Edn5}{8F-Edn5jQ9mNO7UNtOtMwQ}{tnNEd8H_SI-cEyCEC2DLyg}{10.0.1.4}{10.0.1.4:9300}{ml.machine_memory=8589463552, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-03-25T11:49:53,357][INFO ][o.e.h.n.Netty4HttpServerTransport] [8F-Edn5] publish_address {10.0.1.4:9200}, bound_addresses {[::]:9200}
[2019-03-25T11:49:53,359][INFO ][o.e.n.Node               ] [8F-Edn5] started

Are you sure you changed elasticsearch.yml?

This is how it currently looks:

transport.host: 10.0.1.4
transport.tcp.port: 9300 
http.port: 9200
network.host: 10.0.1.4

The file is located within C:\Users\Miao\Downloads\elasticsearch-6.6.2\config.

Out of curiosity I ran curl XGET on my local machine with my remote ES server's WAN IP address. I also received curl: (7) Failed to connect to [WAN IP address] port 9200: Timed out.

I am suspicious of that bound_addresses {[::]:9200} message. On Linux I think this means it's listening on every interface for both IPv4 and IPv6 traffic, but I'm not sure that's the case on Windows. Could you set http.bind_host: 10.0.1.4 to override this too?

I also don't see any evidence yet that there's any connectivity between your local and remote machines on this address. Can you provide some evidence of this?

1 Like

That is correct -- I cannot access Port 9200 on that address from my local machine.

Sure, but can you access anything at all on that machine from your local machine using the address 10.0.1.4? This is not a public IP address: addresses of the form 10.x.x.x are not routable across the internet. I am interested in narrowing the problem down to either Elasticsearch or to your network config.

Miao: is this "remote server" you have been trying to get to from your local machine is a VM (virtual machine) running in your local machine or other machine? if not, are your machine and the remote server on the same network? so far, we can tell that elasticsearch was started properly... the problem is from your local machine to this remote server.

Hello @DavidTurner and @thn, thanks for your replies! To answer your questions:

The remote server is a VM running on another machine.

They do not belong on the same network.

No.