elasticsearch 超过磁盘高水位线[90%][...]碎片将从该节点重新定位

busg9geu  于 2023-01-08  发布在  ElasticSearch
关注(0)|答案(2)|浏览(884)

我尝试运行多节点Elasticsearch从我的本地机器的docker容器。下面是我的docker合成文件:

version: '2.2'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.0
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - C:/Docker/Elasticsearch/data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.0
    container_name: es02
    environment:
      - node.name=es02
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - C:/Docker/Elasticsearch/data02:/usr/share/elasticsearch/data
    networks:
      - esnet
  es03:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.0
    container_name: es03
    environment:
      - node.name=es03
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es02
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - C:/Docker/Elasticsearch/data03:/usr/share/elasticsearch/data
    networks:
      - esnet
  kibana:
    image: docker.elastic.co/kibana/kibana:7.13.0
    container_name: kibana
    environment:
      - "ELASTICSEARCH_HOSTS=http://es01:9200"
    ports:
      - '5601:5601'
    networks:
      - esnet

networks:
  esnet:
    driver: bridge

当我运行docker compose命令时,我收到以下错误:

es01      | {"type": "server", "timestamp": "2021-05-29T12:08:16,409Z", "level": "WARN", "component": "o.e.c.r.a.DiskThresholdMonitor", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "high disk watermark [90%] exceeded on [6UfoOc1-QaCrrRlhLngSkA][es02][/usr/share/elasticsearch/data/nodes/0] free: 17.3gb[7.3%], shards will be relocated away from this node; currently relocating away shards totalling [0] bytes; the node is expected to continue to exceed the high 
disk watermark when these relocations are complete", "cluster.uuid": "dpml3lE2Q0i7NRxFaQcGkQ", "node.id": "F_delTaoRfCASAlmu_Yd-Q"  }

下面是我的Docker资源截图:

下面是来自http://127.0.0.1:9200/的Docker服务器消息

{
  "name" : "es01",
  "cluster_name" : "es-docker-cluster",
  "cluster_uuid" : "dpml3lE2Q0i7NRxFaQcGkQ",
  "version" : {
    "number" : "7.13.0",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "5ca8591c6fcdb1260ce95b08a8e023559635c6f3",
    "build_date" : "2021-05-19T22:22:26.081971330Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.2",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

但是,我的Kibana不起作用了

wsewodh2

wsewodh21#

在评论部分,我已经提到了我的问题,只是为了将来的参考,我在这里解释它:
1.超过磁盘水位线上限[90%][...]碎片将从该节点中移出:每当您遇到系统中可用磁盘空间不足时,这个错误就会出现。所以,为了克服这个问题,我不得不清理一些数据以腾出更多磁盘空间,我当前的可用空间是40GB,运行正常。
1.修复磁盘空间后,我遇到了另一个问题,即“最大虚拟内存区域vm.max_map_count [65530]太低,请至少增加到[262144]"
所以这里我们需要增加Docker的虚拟内存。首先在windows中,我们需要在执行增加虚拟内存命令之前去Docker终端。
如果您的Docker使用wsl子系统,则
1.敞开式电源 shell
1.运行:wsl -d docker-desktop,这将进入Docker终端。
1.运行:sysctl -w vm.max_map_count=262144
重新启动您的Docker,一切就绪。
注:增加虚拟内存的问题已在此处得到解答:https://stackoverflow.com/a/66547784/596495

kcwpcxri

kcwpcxri2#

当您没有将卷挂载到/usr/share/elasticsearch/data时,也会显示此错误消息。ElasticSearch尝试将数据添加到容器的默认文件系统,但失败了。
OP已经挂载了一个卷,但是搜索引擎会把这篇文章放在顶部,所以我把它贴在这里。你可以通过使用docker命令的-v开关添加一个卷来解决这个问题,或者在docker-compose.yml中添加一个卷:

volumes:
      - ${HOST_DATA_DIR}/elasticsearch:/usr/share/elasticsearch/data

相关问题