3
  1. when I do curl on localhost IP It is working but when I am doing it on node IP. It is showing the following error (curl: (7) Failed to connect to 192.168.21.221:9200; Connection refused).

  2. In netstat, the port is listening only on the loopback address

[root@elk ~]# netstat -tnlpu | grep 9200 tcp6 0 0 127.0.0.1:9200 :::* LISTEN 14968/java tcp6 0 0 ::1:9200 :::* LISTEN 14968/java

  1. when I am applying following changes to /etc/elasticsearch/elasticsearch.yml file and restart the elasticsearch service it is failing
network.host: 0.0.0.0
network.host: [_local_, _site_, _global_]
network.host: 0.0.0.0
network.bind_host: 0.0.0.0
network.publish_host: 0.0.0.0
Amit
  • 30,756
  • 6
  • 57
  • 88
sundeep
  • 31
  • 1

1 Answers1

0

Since OP didn't mention the error I am assuming that he tried adding the below configs which would have triggered the production bootstrap checks as network.host: 0.0.0.0 means running in a production environment as you are not binding it to the loopback address.

Most probably OP must be getting below error:

ERROR: 1 bootstrap checks failed 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

And to resolve it, add below config in elasticsearch.yml

discovery.type: single-node

More info on single-node in this answer and After this, if you get an issue related to VM memory then run below command as a root user.

sysctl -w vm.max_map_count=262144

Please note after that command netstat -tnlpu | grep 9200 shows it's not listening on the loopback address.

tcp6 0 0 :::9200 :::*
LISTEN 17247/java

You can also check it with your curl <your-ip>:9200 command.

Amit
  • 30,756
  • 6
  • 57
  • 88