Elasticsearch中生成的數(shù)據(jù)文件一般來說主要有三種,分別是state、index和translog念祭。
查看ES存儲(chǔ)目錄,可發(fā)現(xiàn)有多個(gè)_state目錄碍侦,目錄下存放了以.st為后綴的文件粱坤。例如
這些st文件內(nèi)容在ES源碼里被稱之為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ǔ)。