ElasticSearch 启动错误——默认发现设置不适合生产使用;

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

我尝试在 elasticsearch.yaml 文件中给出以下配置

network.host: aa.bbb.ccc.dd 那是我的 IPv4 地址 和 http.port: 9200

当我在我的 windows 机器上尝试 运行 elasticsearch.bat 时,对此的响应如下:

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

我真的不太清楚要为集群初始化配置什么。默认值为 discovery.seed_hosts: ["host1", "host2"]cluster.initial_master_nodes: ["node-1", "node-2"]

Elasticsearch 7 需要信息来形成集群。这是由 elasticsearch.yml

中的以下两个属性提供的

cluster.initial_master_nodes :这用于提供初始节点集,其投票将在主选举过程中被考虑。

discovery.seed_hosts :这用于提供符合主节点条件的节点集。这应该包含所有符合主节点条件的节点的名称。

因此,例如,您正在形成一个具有三个节点的集群:n0n1n2,它们符合主节点条件,那么您的配置将如下所示:

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

注意:cluster.initial_master_nodes只被elastic使用一次,这是第一次形成集群。

有关更多详细信息,请阅读此 guide

这是我所做的配置,因为我只有一台机器有 Elastic Search 数据库(仅限 1 个节点)。

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

简而言之,如果您是 运行 本地 Elasticsearch(单节点)或仅使用云上的单个节点,那么只需在 elasticsearch.yml 中使用以下配置即可避免生产检查,并且要使其正常工作,请在 答案中了解有关此配置的更多信息:

discovery.type: single-node
  • 我在 elastic-search 7.6.2 版本中也遇到了同样的问题。上述问题的解决方法是,只需要在eleasticsearch.yml文件中添加"discovery.seed_hosts : 127.0.0.1:9300"或设置discovery.type: single-node即可,避免生产使用错误。

  • 单击 here 进行发现和集群形成设置。

  • 我已经提供了详细的答案

我从 docker 容器的角度添加我的答案。我最初在同一个集群中尝试了 运行 3 个弹性搜索节点,然后只尝试了 运行 1 个节点,但遇到了同样的问题。为了解决,我删除了 docker 卷。请注意,我的 docker elasticsearch 节点没有数据,因此不会因 docker 卷删除而丢失数据。

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