ElasticSearch Multiple Data Directories,选择放置索引的位置

ElasticSearch Multiple Data Directories, choose where to place the index

我是 运行 多台服务器上的 ElasticSearch。所有服务器都是平等的,都有 2 个磁盘:一个 SSD 和一个 HDD。不用说,SSD 更快但更小。

我知道您可以通过将路径添加到 elasticsearch.yml 在 ES 中设置多个数据目录。但是,默认情况下,(根据我的发现)ES 会根据可用磁盘 space 的百分比自动选择要使用的数据目录。

有些索引对我来说比其他的更重要,比如说较新的(那些被查询很多的)需要在 SSD 上,而那些查询较少的可以在 HDD 上。

我需要做什么才能完成这项工作 - 如果此时可能的话?
向路径添加索引?

这在 Elasticsearch 中是不可能的。是的,您可以指定多个数据路径,但这些路径不能 "assigned" 到索引。

此时,ES 会将文件级别的数据条带化到所有数据路径,这意味着分片将分布在所有路径上:

Path to directory where to store index data allocated for this node.

path.data: /path/to/data

Can optionally include more than one location, causing data to be striped across the locations (a la RAID 0) on a file level, favouring locations with most free space on creation. For example:

path.data: /path/to/data1,/path/to/data2

另一方面,在 2.0 中 this will change 但您仍然无法在一个数据路径上有一个索引,在另一个数据路径上有另一个索引。

目前,针对您的用例的唯一解决方案是在 "hot" 个节点上安装 SSD,在 "cold" 个节点上安装 HDD,这意味着一个 ES 节点带有 SSD,一个 ES 节点带有 HDD: https://www.elastic.co/guide/en/elasticsearch/guide/current/retiring-data.html#migrate-indices