Elasticsearch中生成的數(shù)據(jù)文件一般來(lái)說(shuō)主要有三種,分別是state、index和translog。
查看ES存儲(chǔ)目錄,可發(fā)現(xiàn)有多個(gè)_state目錄,目錄下存放了以.st為后綴的文件。例如

這些st文件內(nèi)容在ES源碼里被稱(chēng)之為MetaData,緩存了諸如NodeState,ClusterState,IndexState,ShardState等信息

nodes/0/_state/:
這層目錄在節(jié)點(diǎn)級(jí)別,該目錄下的global-1.st文件存儲(chǔ)的是MetaData中除去IndexMetaData的部分,即一些集群級(jí)別的配置和templates。node-0.st中存儲(chǔ)的是NodeId。
nodes/0/indices/2Scrm6nuQOOxUN2ewtrNJw/_state/:
這層目錄在index級(jí)別,2Scrm6nuQOOxUN2ewtrNJw是IndexId,該目錄下的state-2.st文件存儲(chǔ)的是IndexMetaData。
nodes/0/indices/2Scrm6nuQOOxUN2ewtrNJw/0/_state/:
這層目錄在shard級(jí)別,該目錄下的state-0.st存儲(chǔ)的是ShardStateMetaData,包含是否是primary和allocationId等信息。
可以看到,集群相關(guān)的MetaData和Index的MetaData是在不同的目錄中存儲(chǔ)的。另外,集群相關(guān)的Meta會(huì)在所有的MasterNode和DataNode上存儲(chǔ),而Index的Meta會(huì)在所有的MasterNode和存儲(chǔ)了該Index數(shù)據(jù)的DataNode上存儲(chǔ)。