86

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"]

Amit
  • 25,499
  • 6
  • 44
  • 72
SSB
  • 1,302
  • 1
  • 9
  • 11
  • How many nodes master nodes will you be setting up in your cluster? – Nishant Dec 16 '19 at 04:26
  • hay @OpsterESNinjaNishant , by n0,n1 and n2 you mean the IPV4 addresses of other client computers right ? – SSB Dec 16 '19 at 10:00
  • That can be value of `node.name` or IPv4 address of other nodes (elastic instances running on other machine) as well as of self (if it fall in the same category). – Nishant Dec 16 '19 at 11:36
  • @OpsterESNinjaNishant .. by 'elastic instances running on other machine' you mean the machine trying to access the server machine must also have elastic search running in it? – SSB Dec 17 '19 at 04:14
  • No, by 'elastic instances running on other machine' I mean all those server machines that have elastic running on them and which should be the part of same cluster. – Nishant Dec 17 '19 at 06:44
  • well I have just one that is the server. I want it to have remote access so others can access the search data. I tried what u told in the answer section, It dint work. – SSB Dec 17 '19 at 07:41
  • @SSB it has been a long time that you have not upvoted my answer, it would be great if u can upvote the answer if your issue is resolved – Amit Aug 05 '20 at 05:15
  • @OpsterElasticsearchNinja Sorry I dont use stackoverflow unless I have questions to ask. My apologies, I have upvoted your answer and marked it as the right one! Thanks! :) The issue was sort of resolved with the node configurations also but yes, your answer is definitely better and it works! so marked it right! – SSB Sep 12 '20 at 13:48
  • @SSB thanks a lot for your upvote and accepting the answer, you truly understand the community and even went above and beyond to un-accept your own answer and accept another user's answer which is rare and very commendable , hats off to you :) – Amit Sep 13 '20 at 04:48
  • @SSB lf you notice this is one of the most popular question on elasticsearch tag and have been viewed ~11K times :) so having the good content on it, makes it more useful to community :) – Amit Sep 13 '20 at 04:51
  • 1
    @ElasticsearchNinja Its all about better answers. Whatever is the better answer is the answer. And again I am replying a whole month later because I don't login too often. Thanks for your answer! I am sure its helping many :) ;) – SSB Oct 21 '20 at 04:03
  • @SSB, you are right, and appreciate your actions :) – Amit Oct 21 '20 at 05:07
  • @ElasticsearchNinja could you please share your thoughts on this one ? https://stackoverflow.com/questions/65897286/can-i-filter-an-array-in-elastic – SSB Jan 26 '21 at 08:48

5 Answers5

166

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
Amit
  • 25,499
  • 6
  • 44
  • 72
33

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 : []
SSB
  • 1,302
  • 1
  • 9
  • 11
  • 3
    I've also tried with `discovery.seed_hosts : ["localhost", "127.0.0.1"]` and works great. Thanks – Martin Feb 11 '20 at 01:32
11

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.

Nishant
  • 6,898
  • 1
  • 18
  • 33
  • 6
    This answer is good general advice, but the answer to this specific question is to set `discovery.seed_hosts: ["aa.bbb.ccc.dd"]` or `discovery.seed_hosts: []`. Either is fine in a one-node cluster. – Dave Turner Dec 17 '19 at 08:13
  • 1
    @DaveTurner You are right. If the OP wants to have only one node cluster, but I never got a clear answer for that when I asked about the number of nodes. – Nishant Dec 17 '19 at 09:03
9
  • 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.

Keshav Lodhi
  • 1,820
  • 1
  • 14
  • 19
0

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