ElasticSearch start up error - the default discovery settings are unsuitable for production use;

ElasticsearchStartupElasticsearch 7

Elasticsearch Problem Overview


I have tried giving the following configurations in the elasticsearch.yaml file

network.host: aa.bbb.ccc.dd that being my IPv4 Address and http.port: 9200

The response to this is as follows when I try to run elasticsearch.bat on my windows machine:

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

I am really not quite sure what to configure for the cluster initialization. The default values are discovery.seed_hosts: ["host1", "host2"] and cluster.initial_master_nodes: ["node-1", "node-2"]

Elasticsearch Solutions


Solution 1 - Elasticsearch

In short, if you are running Elasticsearch locally(single node) or just with a single node on the cloud then just use below config in your elasticsearch.yml to avoid the production check, and to make it work, more info about this config in this SO answer:

discovery.type: single-node

Solution 2 - Elasticsearch

This is the configuration I did since I had only one machine that had the Elastic Search db in it (1 node Only).

node.data : true
network.host : 0.0.0.0
discovery.seed_hosts : []
cluster.initial_master_nodes : []

Solution 3 - Elasticsearch

Elasticsearch 7 requires information to form a cluster. This is provided by the following two properties in elasticsearch.yml

cluster.initial_master_nodes : This is used to provide the initial set of nodes whose vote will be consider in master election process.

discovery.seed_hosts : This is used to provide the set of nodes which are master eligible. This should contain the name of all nodes which are master eligible.

So for example you are forming a cluster with three nodes : n0, n1, n2 which are master eligible then you config will look something like this:

cluster.initial_master_nodes: ["n0", "n1", "n2"]
discovery.seed_hosts: ["n0", "n1", "n2"]

Note: cluster.initial_master_nodes is used only once by elastic which is very first time of cluster formation.

For more detailed information read this guide.

Solution 4 - Elasticsearch

  • I have also faced the same issue with the elastic-search 7.6.2 version. The solution of the above-mentioned problem is, you just need to either add "discovery.seed_hosts : 127.0.0.1:9300" or set discovery.type: single-node in eleasticsearch.yml file to avoid the production use error.

  • Click here for discovery and cluster formation settings.

  • I have provided the detailed answer here.

Solution 5 - Elasticsearch

I am adding my answer from docker container perspective. I initially tried running 3 nodes of elasticsearch in a same cluster and then tried running only 1 and faced same issue. To resolve, I deleted docker volumes. Please note, my docker elasticsearch nodes had no data so there was no data loss due to docker volume deletion.

https://discuss.elastic.co/t/how-my-config-file-should-be-on-publish-mode-with-a-single-node/189034

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSSBView Question on Stackoverflow
Solution 1 - ElasticsearchAmitView Answer on Stackoverflow
Solution 2 - ElasticsearchSSBView Answer on Stackoverflow
Solution 3 - ElasticsearchNishantView Answer on Stackoverflow
Solution 4 - ElasticsearchKeshav LodhiView Answer on Stackoverflow
Solution 5 - ElasticsearchShashank SharmaView Answer on Stackoverflow