Elasticsearch 5卡住了从磁盘

时间:2017-07-19 09:51:17

标签: java elasticsearch elasticsearch-5

我有一个包含 ES 5.4 的6个节点的群集, 4B小文档但已编入索引。
文档按 ~9K索引进行组织,总计 2TB 。索引'占用率从几KB到几百GB不等,并且为了将每个碎片保持在20GB以下进行分片。

群集运行状况查询响应:

{
    cluster_name: "##########",
    status: "green",
    timed_out: false,
    number_of_nodes: 6,
    number_of_data_nodes: 6,
    active_primary_shards: 9014,
    active_shards: 9034,
    relocating_shards: 0,
    initializing_shards: 0,
    unassigned_shards: 0,
    delayed_unassigned_shards: 0,
    number_of_pending_tasks: 0,
    number_of_in_flight_fetch: 0,
    task_max_waiting_in_queue_millis: 0,
    active_shards_percent_as_number: 100
}

在向群集发送任何查询之前,它是稳定的,并且每秒都会获得一个批量索引查询,其中包含10个或几千个没有问题的文档。

在将一些流量重定向到此群集之前,一切都很好。 一旦它开始响应大多数服务器开始以250 MB / s从磁盘读取,使群集无响应enter image description here

奇怪的是,我在AWS上克隆了这个ES配置(相同的硬件,相同的Linux内核,但是不同的Linux版本),我没有问题: enter image description here 注意:请注意,40MB / s的磁盘读取是我在服务流量的服务器上一直使用的。

相关的Elasticsearch 5配置是:

    Xms12g -Xmx12g
  • jvm.options

我还使用以下配置对其进行了测试,但没有成功:

  • bootstrap.memory_lock:true
  • MAX_OPEN_FILES=1000000

每台服务器都有 16CPU和32GB内存;有些人有Linux Jessie 8.7,其他有Jessie 8.6;都有内核3.16.0-4-amd64。

我使用localhost:9200/_nodes/stats/indices/query_cache?pretty&human检查了每个节点上的缓存,并且所有服务器都有类似的统计信息:缓存大小,缓存命中,未命中和驱逐。

它似乎不是一个热身操作,因为在AWS克隆的群集上我从未看到过这种行为,也因为它永远不会结束。
我无法在/var/log/elasticsearch/*下找到有用的信息。

我做错了吗? 为了解决这个问题,我应该改变什么?

谢谢!

3 个答案:

答案 0 :(得分:0)

您可能需要减少搜索的线程数。 尝试使用2倍的处理器数量。在elasticsearch.yaml:

function loop() {
    //consider this as steps of animation
    if(angles[0] ==45) {
         pause(5500, 1); 
    } else if(angles[0] ==90) {
         pause(5500, 2); 
    }else if(angles[0] ==135) {
      pause(5500, 3); 
    }else if(angles[0] ==180) {
      pause(5500, 0);
    }else if(angles[0] ==225) {
      pause(5500, 1); 
    }else if(angles[0] ==270) {
      pause(5500, 2);
    }else if(angles[0] ==315) {
      pause(5500, 3);
    }else if(angles[0] ==0) {
      pause(5500, 0);
    }else {
            requestAnimationFrame(loop);
    }   
            for(var i = 0; i < angles.length; i++) {
        var angle = angles[i];        
        x = cx + radius * Math.cos(angle * deg2rad);
        y = cy + radius * Math.sin(angle * deg2rad);
        $('#sat' + i).css({left:x - radiusSat, top:y - radiusSat});
        $('#sat' + i).attr('data-angle', angle);
        angles[i] = angles[i] + 1;
        if(angles[i] == 360) angles[i] =0;       
    }

}

function pause(time, id){   
    $(".text").hide();
  $(".text:eq("+id+")").show();  
    setTimeout(function(){
    requestAnimationFrame(loop);
  }, time); 
}

此外,对于6节点群集来说,这听起来像是太多分片。如果可能的话,我会尝试减少它。

答案 1 :(得分:0)

HTTP请求的最大内容。默认为100mb

servers start reading from disk at 250 MB/s making the cluster unresponsive-HTTP请求的最大内容。默认为100mb。 。如果设置为大于Integer.MAX_VALUE,它将重置为100mb。

这将变得无响应,您可能会看到与此相关的日志。检查索引的最大读取大小。

使用Elasticsearch HTTP

进行检查

答案 2 :(得分:0)

一些事情;

  1. 5.x 已经 EOL 多年了,请紧急升级
  2. 你严重过度分片

对于第 2 点 - 您要么需要;

  1. 升级以处理这么多分片,7.X 中的内存管理要好得多
  2. 通过重新索引减少分片数量
  3. 添加更多节点来处理负载