【问题标题】:elasticsearch: distributing indices over multiple disk volumeselasticsearch:在多个磁盘卷上分配索引
【发布时间】:2017-11-20 09:25:10
【问题描述】:

我有一个相当大的索引(大约 100Gb),所以我不得不通过添加另一个卷来扩展我的数字海洋调查的磁盘空间(我只在一个节点上运行所有内容)。我告诉 elasticsearch 它现在必须考虑两个磁盘位置

/usr/share/elasticsearch/bin/elasticsearch -Epath.data=/var/lib/elasticsearch,/mnt/volume-sfo2-01/es_data

elasticsearch 似乎确实注意到了这一点,因为它在新位置写了一些东西

/mnt/volume-sfo2-01/es_data# cd nodes/
/mnt/volume-sfo2-01/es_data/nodes# ls
0
/mnt/volume-sfo2-01/es_data/nodes# cd 0/
/mnt/volume-sfo2-01/es_data/nodes/0# ls
indices  node.lock  _state
/mnt/volume-sfo2-01/es_data/nodes/0# cd indices
/mnt/volume-sfo2-01/es_data/nodes/0/indices# ls
DixLGLrJRXm1gSYcFzkzzw  nmZbce8wTayJC2s_eMC0-g  Qd-9ZnFIRoSM2z7AohKm-w  Sm_tyYTJTty0ImvDamFaQw
/mnt/volume-sfo2-01/es_data/nodes/0/indices# cd DixLGLrJRXm1gSYcFzkzzw/
/mnt/volume-sfo2-01/es_data/nodes/0/indices/DixLGLrJRXm1gSYcFzkzzw# ls
_state

这与我在 /var/lib/elasticsearch/data 中找到的内容相同,但最低级别的实际索引信息除外。

阅读 elasticsearch 文档后,我得到的印象是,elasticsearch 正在将新索引安排在两个磁盘位置上,但不会在两个位置之间拆分分片。所以我用 5 个分片初始化索引,以便它可以在卷之间拆分数据。

自日志文件显示以来,调查似乎确实检测到了这两个数据路径

[2017-06-17T19:16:57,079][INFO ][o.e.e.NodeEnvironment    ] [WU6cQ-o] using [2] data paths, mounts [[/ (/dev/vda1), /mnt/volume-sfo2-01 (/dev/sda)]], net usable_space [29.6gb], net total_space [98.1gb], spins? [possibly], types [ext4]

但是,当我索引新索引时,会不断使用原始磁盘上的所有磁盘空间并最终用完磁盘空间并出现错误

raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.TransportError: TransportError(500, u'index_failed_engine_exception', u'Index failed for [pubmed_paper#25949809]')

它永远不会将其中一个碎片转移到第二卷?我想念什么吗?可以手动引导磁盘空间使用吗?

这里是 elasticsearch 版本的详细信息:

# curl -XGET 'localhost:9200'
{
  "name" : "WU6cQ-o",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "hKc147QfQqCefLliStLNtw",
  "version" : {
    "number" : "5.1.1",
    "build_hash" : "5395e21",
    "build_date" : "2016-12-06T12:36:15.409Z",
    "build_snapshot" : false,
    "lucene_version" : "6.3.0"
  },
  "tagline" : "You Know, for Search"
}

这里是默认的路径文件结构,其中 ekasticsearch 存储所有信息(而不是与第二个路径共享)

/var/lib/elasticsearch/elasticsearch/nodes/0/indices/DixLGLrJRXm1gSYcFzkzzw# ls
0  1  2  3  4  _state

一个问题可能是我是否可以只取其中一个碎片并将其移动到另一个位置?

【问题讨论】:

  • 您在elasticsearch中创建了5个分片后,您可以分享路径nodes/0/indices/DixLGLrJRXm1gSYcFzkzzw的最新文件夹结构以及您使用的是哪个ES版本。
  • hi sumit...我在上面添加了你问的信息,干杯卡尔
  • @carl 很明显,ES 将所有分片分配在一个 path.data 上,因此它不会移动到另一条路径,因为它是一次性的。您是否尝试过减少和增加分片的数量?
  • 嗨 Sumit... 我没有尝试更改分片的数量。我索引文档并在某些时候耗尽了磁盘空间。我的期望是 es 会移动碎片?如果 es 没有那种能力,当然可以解释这种行为??

标签: elasticsearch


【解决方案1】:

您可以做的是,向您的系统添加一个 1TB 大小的硬盘并将 100GB 的数据复制到新硬盘并更新您的数据目录位置以指向新硬盘,不要同时提供两个路径,否则它会尝试也将数据写入旧路径

【讨论】:

  • 您能描述一下我将如何手动移动索引吗?我只是不想破坏任何东西。
  • 第 1 步:将数据目录的内容复制到新位置(可能是新硬盘) 第 2 步:更改指向新位置的数据目录路径 所以有时数据会开始写入新位置..
  • 执行超过 100GB 的复制操作最多需要 3-5 个小时,所以我想你会在某个时候找到解决方案...
猜你喜欢
  • 2020-09-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-06
  • 1970-01-01
  • 2010-09-08
  • 2012-07-09
  • 2012-04-15
相关资源
最近更新 更多