I'm trying to run ElasticSearch and view the webpage from a different machine.
On my Debian desktop, elasticsearch-5.0.1/bin/elasticsearch -E network.host=100.96.149.173 works. I can access machine_hostname:9200.
But running the same command in a Google Compute Engine VM gives:
[2018-02-20T21:45:54,967][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thre
ad [main]
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested
: BindException[Cannot assign requested address];
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-5.0.2.jar
:5.0.2]
It appears I need a different set of flags for VMs, but I can't figure out what.
elasticsearch-5.0.2/bin/elasticsearch -E network.host=<external ip address>
I also tried discovery-gce plugin. If I do elasticsearch-5.0.2/bin/elasticsearch -E network.host=_gce:hostname_ or elasticsearch-5.0.2/bin/elasticsearch -E network.host=_gce_, I can curl against internal IP. But I want to curl against external IP. There doesn't seem to be a discovery-gce option for that.
[2018-02-20T22:15:58,641][INFO ][o.e.t.TransportService ] [urZOilT] publish_address {10.138.0.4:9300}, bo
und_addresses {[::]:9300}
10.138.0.4 is the VM's internal IP. I confirmed if I run curl 10.138.0.4:9200 inside VM works. But loading external_ip:9200 from outside the VM doesn't work.
This should be easy for you to reproduce, just create a Debian VM on Google Compute Engine.
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 42:01:0a:8a:00:04 brd ff:ff:ff:ff:ff:ff
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.