docker compose一键部署Kibana7.71.25实战

                                              作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.编写docker-compose文件

version: '3.3'

services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.25
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=yinzhengjie-linux-es-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:
      - data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - elastic

  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.25
    container_name: es02
    environment:
      - node.name=es02
      - cluster.name=yinzhengjie-linux-es-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:
      - data02:/usr/share/elasticsearch/data
    networks:
      - elastic

  es03:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.25
    container_name: es03
    environment:
      - node.name=es03
      - cluster.name=yinzhengjie-linux-es-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:
      - data03:/usr/share/elasticsearch/data
    networks:
      - elastic

  kibana:
    image: docker.elastic.co/kibana/kibana:7.17.25
    # 环境变量参考设置: https://www.elastic.co/guide/en/kibana/7.17/settings.html
    # 注意,在配置时,要将"."变为"_",小写字母转变为大写字母
    environment:
      SERVER_NAME: yinzhengjie-linux-kibana
      ELASTICSEARCH_HOSTS: '["http://es01:9200","http://es02:9200","http://es03:9200"]'
      I18N_LOCALE: zh-CN
    ports:
      - 5601:5601
    networks:
      - elastic

volumes:
  data01:
    driver: local
  data02:
    driver: local
  data03:
    driver: local

networks:
  elastic:
    driver: bridge

二.启动实例

docker-compose up -d
posted @ 2024-11-02 01:07  尹正杰  阅读(22)  评论(0编辑  收藏  举报