ElasticSearch存储持久设置在哪里? [英] Where does ElasticSearch store persistent settings?

查看:563
本文介绍了ElasticSearch存储持久设置在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过

curl -XGET localhost:9200/_cluster/settings 

我看到持续和暂时的设置。

I see persistent and transient settings.

{
  "persistent": {
    "cluster.routing.allocation.cluster_concurrent_rebalance": "0",
    "threadpool.index.size": "20",
    "threadpool.search.size": "30",
    "cluster.routing.allocation.disable_allocation": "false",
    "threadpool.bulk.size": "40"
  },
  "transient": {}
}

如果我设置一个永久设置,它不保存到我的 config / elasticsearch.yml 配置文件?所以我的问题是我的服务器重新启动,它怎么知道我的持久设置是什么?

If I set a persistent setting, it doesn't save it to my config/elasticsearch.yml config file? So my question is when my server restarts, how does it know what my persistent settings are?

不要告诉我不要担心,因为我几乎失去了我的整个集群的数据,因为它重新启动配置文件中的所有设置,而不是上面显示的持久设置:)

Don't tell me not to worry about it because I almost lost my entire cluster worth of data because it picked up all the settings in my config file after it restarted, NOT the persistent settings shown above :)

推荐答案

p>永久设置存储在全局集群状态文件中的每个主节点节点上,可以在Elasticsearch数据目录中找到: data / CLUSTER_NAME / nodes / N / _state ,其中 CLUSTER_NAME 是集群的名称, N 是节点号( 0 如果这是此机器上唯一的节点)。文件名具有以下格式: global-NNN 其中 NNN 是集群状态的版本。

Persistent settings are stored on each master-eligible node in the global cluster state file, which can be found in the Elasticsearch data directory: data/CLUSTER_NAME/nodes/N/_state, where CLUSTER_NAME is the name of the cluster and N is the node number (0 if this is the only node on this machine). The file name has the following format: global-NNN where NNN is the version of the cluster state.

除了永久设置,此文件可能包含其他全局元数据,如索引模板。默认情况下,全局集群状态文件以二进制SMILE格式存储。为了进行调试,如果要查看实际存储在此文件中的内容,可以通过将以下行添加到 elasticsearch.yml 文件中来将此文件的格式更改为JSON :

Besides persistent settings this file may contain other global metadata such as index templates. By default the global cluster state file is stored in the binary SMILE format. For debugging purposes, if you want to see what's actually stored in this file, you can change the format of this file to JSON by adding the following line to the elasticsearch.yml file:


格式:json

每当集群状态发生变化时,所有主节点的节点将存储新版本的文件,因此在集群重新启动期间首先启动并选择自身作为主节点的节点将具有集群状态的最新版本。如果您的主要合格节点之一不是集群的一部分(因此无法存储具有设置的最新版本),并且在重新启动该节点成为集群主节点之后更新设置,您可以描述的内容并将其过时的设置传播到所有其他节点。

Every time cluster state changes, all master-eligible nodes store the new version of the file, so during cluster restart the node that starts first and elects itself as a master will have the newest version of the cluster state. What you are describing could be possible if you updated the settings when one of your master-eligible nodes was not part of the cluster (and therefore couldn't store the latest version with your settings) and after the restart this node became the cluster master and propagated its obsolete settings to all other nodes.

这篇关于ElasticSearch存储持久设置在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆