docker-compose安装ElasticSearch和Kibana

本次测试环境,win10,ES采用7.3.0版本。索引数据存在于F盘。

  • docker-compose文件。

此文件需要被命名为docker-compose.yml,然后在文件所在目录执行相关命令。

version: '2.2'
services:
  es01:
    image: elasticsearch:7.3.0
    container_name: es01
    environment:
      - node.name=es01
      - discovery.seed_hosts=es02
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-elasticsearch-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      nofile:
        soft: 65536
        hard: 65536
      memlock:
        soft: -1
        hard: -1
    volumes:
      - /F/tmp/docker/elasticsearch/es01/data:/usr/share/elasticsearch/data
      - /F/tmp/docker/elasticsearch/es01/logs:/usr/share/elasticsearch/logs
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - esnet
  es02:
    image: elasticsearch:7.3.0
    container_name: es02
    environment:
      - node.name=es02
      - discovery.seed_hosts=es01
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-elasticsearch-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      nofile:
        soft: 65536
        hard: 65536
      memlock:
        soft: -1
        hard: -1
    volumes:
      - /F/tmp/docker/elasticsearch/es02/data:/usr/share/elasticsearch/data
      - /F/tmp/docker/elasticsearch/es02/logs:/usr/share/elasticsearch/logs
    ports:
      - 9201:9200
      - 9301:9300
    networks:
      - esnet
  kibana:
    image: kibana:7.3.0
    container_name: kibana
    environment:
      - ELASTICSEARCH_HOSTS=http://es01:9200
      # 需要将Kibana配置文件中的小写转换成大写,然后这个才能用于变量,才能被设置到
      - I18N_LOCALE=zh-CN
      - xpack.monitoring.ui.container.elasticsearch.enabled=false
    ports:
      - 5601:5601    
    networks:
      - esnet

networks:
  esnet:
    driver: bridge
  • 启动步骤

执行命令(首次):

E:\资料\dockers\elastic-compose>docker-compose  --log-level DEBUG  up

再次运行容器时,请执行命令:

E:\资料\dockers\elastic-compose>docker-compose  --log-level DEBUG  start
  • 以下是效果:

索引文件、日志文件位置:

 

docker-compose安装ElasticSearch和Kibana_第1张图片docker-compose安装ElasticSearch和Kibana_第2张图片

你可能感兴趣的:(docker-compose安装ElasticSearch和Kibana)