Hi, I have elastic search cluster of 2 nodes and trying to call the REST API from a spring boot application using a rest client. It's giving me connection refused error every time. It works when I set the network.host: 0.0.0.0
Since this is not recommended way for production server, what will work for production?
Elastic search cluster is working fine. My old settings which used to work with ES 6.6.1 is as follows:
Hi David,
I found out in some of the discussion forums that having the value 0.0.0.0 is not advisable for security reasons for PROD environment. Is it okay to use 0.0.0.0 in PROD environments?
Why it doesn't work when I bind to localhost and hostname both?
You should not expose your cluster on internet for sure. Without any security, definitely.
But if you are in a backend layer, that's ok to expose elasticsearch to other backend machines like your own application.
If your application is not running on the same machine, then you need to define network.host to be reachable from the other application.
I wonder if you should write it that way though:
network.host: host-1, _local_
BTW this can be a bad practice as we recommend having 3 master eligible nodes in the cluster.
My Applications are on the cloud. Both Elastic search and client are deployed on cloud. That's the reason I was trying to avoid using 0.0.0.0. ES nodes has a public IP and can be accessed from outside. Any suggestions how I can make it work?
Also I tried your suggestion of bringing the hostname before "local" and it did not work for me. I am getting the same connection refused error.
Does cloud mean not secured for you? I mean that you can secure elasticsearch from 6.8 and 7.1.
Also I tried your suggestion of bringing the hostname before " local " and it did not work for me. I am getting the same connection refused error.
What are the logs then?
BTW did you look at Elastic Cloud: Hosted Elasticsearch, Hosted Search | Elastic?
Cloud by elastic is one way to have access to all features, all managed by us. Think about what is there yet like Security, Monitoring, Reporting, SQL, Canvas, APM, Logs UI, Infra UI and what is coming next ... It starts at around $15 per month IIRC.
I just want to understand if there is any other setting that I can try instead of 0.0.0.0 in network.host to make it work? That means, I should be able to call the ES API from a rest client of my application.
Running out ideas. And as I probably don't have the right names/IP may be you changed something in logs/config/... which makes that more complicated to diagnose.
Out of curiosity, are you exposing your cluster on internet and that's why you don't want to share the real logs, config?
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.