使用XPack设置ElasticSearch和Kibana图像

时间:2018-06-04 09:47:50

标签: docker elasticsearch docker-compose kibana

我尝试使用官方的Kibana和ElasticSearch图片,但他们只是退出并显示错误消息。在启动几秒钟后,容器的状态如下所示:

     Name             State               
------------------------------
elasticsearch        Exit 1                                                                             
elasticsearch1       Exit 78                                                                           
mongotest_kafka_1    Up        
mongotest_kibana_1   Exit 1                   

其中一张图片的错误讯息:

elasticsearch1    | ERROR: [1] bootstrap checks failed
elasticsearch1    | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
elasticsearch1    | [2018-06-04T09:37:17,274][INFO ][o.e.n.Node               ] [L0Tp7dx] stopping ...
elasticsearch1    | [2018-06-04T09:37:17,289][INFO ][o.e.n.Node               ] [L0Tp7dx] stopped
elasticsearch1    | [2018-06-04T09:37:17,289][INFO ][o.e.n.Node               ] [L0Tp7dx] closing ...
elasticsearch1    | [2018-06-04T09:37:17,296][INFO ][o.e.n.Node               ] [L0Tp7dx] closed
elasticsearch1    | [2018-06-04T09:37:17,298][INFO ][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started

我不确定docker-compose.yml中的某些配置是否错误:

version: '3.3'
services:
  kafka:
      image: spotify/kafka
      ports:
        - "9092:9092"
      environment:
      - ADVERTISED_HOST=localhost
  elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
      container_name: elasticsearch
      environment:
        - cluster.name=docker-cluster
        - bootstrap.memory_lock=true
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - esdata1:/usr/share/elasticsearch/data
      ports:
        - 9200:9200
      networks:
        - esnet
  elasticsearch1:
      image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
      container_name: elasticsearch1
      environment:
        - cluster.name=docker-cluster
        - bootstrap.memory_lock=true
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        - "discovery.zen.ping.unicast.hosts=elasticsearch"
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - esdata2:/usr/share/elasticsearch/data
      networks:
        - esnet
  kibana:
      image: docker.elastic.co/kibana/kibana:6.2.4
      environment:
        SERVER_NAME: kibana
        SERVER_NAME: "0"
        ELASTICSEARCH_URL: http://elasticsearch:9200
        ELASTICSEARCH_USERNAME: elastic
        ELASTICSEARCH_PASSWORD: changeme
        XPACK_MONITORING_UI_CONTAINER_ELASTICSEARCH_ENABLED: "true"
      networks:
        - esnet
volumes:
  esdata1:
    driver: local
  esdata2:
      driver: local

networks:
  esnet:

1 个答案:

答案 0 :(得分:2)

这需要在docker主机上配置(弹性堆栈有一些要求高于默认的Linux主机安装)。 Elastic has documentation on this process,包括虚拟内存设置。对于此特定错误,您可以运行以下命令:

equals

您希望在/etc/sysctl.conf中对此进行配置,以便设置在重新启动后仍然存在。