Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does ElasticSearch store persistent settings?

When I get my ElasticSearch server settings via

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": {}
}

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 :)

like image 734
Henley Avatar asked Feb 15 '14 23:02

Henley


People also ask

Where is the Elasticsearch config file?

The Elasticsearch configuration files are in the /etc/elasticsearch directory.

What does Elasticsearch store in memory?

Elasticsearch will store all the data you put into it by default, so it works both as a search engine and a document store.

Is Elasticsearch persistent?

In Elasticsearch, persistent refers to cluster settings that persist across cluster restarts. This setting is used in Cluster Update API calls. Persistent settings can also be configured in the elasticsearch. yml file.

What is transient and persistent in Elasticsearch?

Transient – Changes that will not persist after a full cluster restart. Persistent – Changes that will be saved after a full cluster restart.


1 Answers

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.

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:

format: 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.

like image 116
imotov Avatar answered Sep 23 '22 03:09

imotov