I've been trying to get elastic search (running behind a vpn) to listen to incoming requests from other machines on port 9200
using ipv4
. Without modifying the default elasticsearch.yml
, I ran netstat
and received:
tcp6 0 0 127.0.0.1:9200 :::* LISTEN 8079/java
tcp6 0 0 ::1:9200 :::* LISTEN 8079/java
tcp6 0 0 127.0.0.1:9300 :::* LISTEN 8079/java
tcp6 0 0 ::1:9300 :::* LISTEN 8079/java
With the default settings, I could curl
elastic search fine from inside the machine, but could not connect curl it from outside using curl -XGET [IP]:9200
(curl: (7) Failed to connect to [IP] port 9200: Connection refused
)
I set network.host: 0.0.0.0
, stopped and started elastic search sudo systemctl start elasticsearch.service
and waited for a minute or two, but nothing was listening on 0.0.0.0:9200
. I've also tried _local_:ipv4
and 0.0.0.0:ipv4
with no luck.
I added -Djava.net.preferIPv4Stack=true
to jvm.options and now I am getting (with # network.port
commented out):
tcp 0 0 127.0.0.1:9200 0.0.0.0:* LISTEN 11131/java
tcp 0 0 127.0.0.1:9300 0.0.0.0:* LISTEN 11131/java
I tried to set network.host: 0.0.0.0
again and restart the service but now I don't see it listening to any ports.
In the log files I receive an error [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
Setting cluster.initial_master_nodes: node-1
fixed it. Works.
I added -Djava.net.preferIPv4Stack=true
to jvm.options
. Also added cluster.initial_master_nodes: node-1
to elasticsearch.yml.
According to https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#network-interface-values you can add :ipv4
or :ipv6
suffixes to network.host
, network.bind_host
, network.publish_host
, like: _en0:ipv4_
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With