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

查看:40
本文介绍了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 :)

推荐答案

持久化设置存储在全局集群状态文件中的每个master-eligible节点上,可以在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天全站免登陆