docker-compose错误:引导检查失败| max>虚拟内存区域vm.max_map_count [65530]太低,请增加到至少[262144]

时间:2019-09-18 17:34:46

标签: docker elasticsearch memory-management docker-compose

我收到此错误:

  

es01 | {“类型”:“服务器”,“时间戳”:   “ 2019-09-18T17:31:42,267 + 0000”,“级别”:“ INFO”,“组件”:   “ o.e.n.Node”,“ cluster.name”:“ docker-cluster”,“ node.name”:“ es01”,   “ message”:“正在启动...”} es01 | {“ type”:“服务器”,   “ timestamp”:“ 2019-09-18T17:31:42,709 + 0000”,“ level”:“ INFO”,   “ component”:“ o.e.t.TransportService”,“ cluster.name”:   “ docker-cluster”,“ node.name”:“ es01”,“ message”:“ publish_address   {172.21.0.3:9300},bound_addresses {0.0.0.0:9300}“} es01 |   {“ type”:“服务器”,“时间戳”:“ 2019-09-18T17:31:42,760 + 0000”,   “ level”:“ INFO”,“ component”:“ o.e.b.BootstrapChecks”,“ cluster.name”:   “ docker-cluster”,“ node.name”:“ es01”,“ message”:“绑定或   发布到非环回地址,强制执行引导检查”“}

重要的错误

  

错误:[1]引导程序检查失败es01 | [1]:最大   虚拟内存区域vm.max_map_count [65530]太低,增加到   至少[262144]

,然后节点由于上述错误而停止:

  

es01 | {“类型”:“服务器”,“时间戳”:   “ 2019-09-18T17:31:42,810 + 0000”,“级别”:“ INFO”,“组件”:   “ o.e.n.Node”,“ cluster.name”:“ docker-cluster”,“ node.name”:“ es01”,   “ message”:“正在停止...”} es01 | {“ type”:“服务器”,   “ timestamp”:“ 2019-09-18T17:31:42,904 + 0000”,“ level”:“ INFO”,   “ component”:“ o.e.n.Node”,“ cluster.name”:“ docker-cluster”,   “ node.name”:“ es01”,“ message”:“已停止”} es01 | {“类型”:   “服务器”,“时间戳”:“ 2019-09-18T17:31:42,905 + 0000”,“级别”:   “ INFO”,“ component”:“ o.e.n.Node”,“ cluster.name”:“ docker-cluster”,   “ node.name”:“ es01”,“ message”:“关闭...”} es01 | {“类型”:   “服务器”,“时间戳”:“ 2019-09-18T17:31:42,967 + 0000”,“级别”:   “ INFO”,“ component”:“ o.e.n.Node”,“ cluster.name”:“ docker-cluster”,   “ node.name”:“ es01”,“ message”:“ closed” {“类型”:   “服务器”,“时间戳”:“ 2019-09-18T17:31:42,976 + 0000”,“级别”:   “ INFO”,“ component”:“ o.e.x.m.p.NativeController”,“ cluster.name”:   “ docker-cluster”,“ node.name”:“ es01”,“ message”:“本地控制器   进程已停止-无法启动新的本机进程”}

我的docker-compose.yml文件如下:

version: '2.2'
services:
  kibana:
    depends_on:
      - es01
      - es02
    image: docker.elastic.co/kibana/kibana:7.3.1
    container_name: kibana
    ports:
      - 5601:5601
    environment:
      ELASTICSEARCH_HOSTS: http://es01:9200
      ELASTICSEARCH_URL: http://es01:9200
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.3.1
    container_name: es01
    environment:
      - node.name=es01
      - discovery.seed_hosts=es02
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.3.1
    container_name: es02
    environment:
      - node.name=es02
      - discovery.seed_hosts=es01
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata02:/usr/share/elasticsearch/data

volumes:
  esdata01:
    driver: local
  esdata02:
    driver: local

有人知道我如何增加群集的内存并修复错误吗?

2 个答案:

答案 0 :(得分:0)

看起来该解决方案正在使用: https://github.com/docker-library/elasticsearch/issues/111

建议在ubuntu上运行此

sudo sysctl -w vm.max_map_count=262144

答案 1 :(得分:0)

如果您密切关注官方的Elasticsearch Docker documentation

您需要设置vm.max_map_count选中此here