elk in docker

version: '3.7'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
    container_name: es01
    environment:
      - node.name=es01
      - network.host=_site_
      - 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
    networks:
      - esnet
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
    container_name: es02
    environment:
      - node.name=es02
#      - network.host=_local_
      - 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
#      - /home/wbhhc/docker/elk/config/es02/config:/usr/share/elasticsearch/config
    networks:
      - esnet
  kibana:
    image: docker.elastic.co/kibana/kibana:7.2.0
    container_name: kibana
    volumes:
      - /home/wbhhc/docker/elk/config/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml
    ports:
      - 5601:5601
    networks:
      - esnet
  metricbeat:
    image: docker.elastic.co/beats/metricbeat:7.2.0
    user: root
    container_name: metricbeat
    volumes:
      - /proc:/hostfs/proc:ro
      - /:/hostfs:ro
      - /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ~/docker/elk/config/metricbeat/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro
      - ~/docker/elk/config/metricbeat/modules.d/kafka.yml:/usr/share/metricbeat/modules.d/kafka.yml
#    environment:
#      - setup.kibana.host=kibana:5601
#      - output.elasticsearch.hosts=["es01:9200","es02:9200"]
    networks:
      - esnet
  filebeat:
    image: docker.elastic.co/beats/filebeat:7.2.0
    user: root
    container_name: filebeat
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/containers/:/var/lib/docker/containers/:ro
#      - /var/log/:/var/log/:ro
      - ~/docker/elk/config/filebeat/filebeat.docker.yml:/usr/share/filebeat/filebeat.yml:ro
      - ~/docker/elk/config/filebeat/modules.d:/usr/share/filebeat/modules.d
      - ~/docker/elk/logs:/usr/share/filebeat/logs
      - ~/docker/elk/data:/usr/share/filebeat/data

      - ~/docker/elk/logs/kafka:/usr/share/logs/kafka
    environment:
      - BEAT_STRICT_PERMS=false
#    command: ["--strict.perms=false"]
    networks:
      - esnet

  zoo1:
    image: wurstmeister/zookeeper
    container_name: zoo1
    restart: always
    hostname: zoo1
    ports:
      - 2181:2181
    networks:
      - esnet

  zkui:
    hostname: zkui
    container_name: zkui
    image: juris/zkui
    restart: always
    environment:
      ZK_SERVER: zoo1:2181
    depends_on:
     - zoo1
#    links:
#    #     - zoo1
    ports:
     - 9090:9090
#             # 账号admin 密码manager
    networks:
     - esnet
  
  kafka:
    image: wurstmeister/kafka
    container_name: kafka
    ports:
     - 9092:9092
    environment:
      KAFKA_ADVERTISED_HOST_NAME: kafka
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ZOOKEEPER_CONNECT: zoo1:2181
      KAFKA_BROKER_ID: 1
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
      KAFKA_LISTENERS: PLAINTEXT://kafka:9092
      KAFKA_CREATE_TOPICS: "test:1:1"
    volumes:
     - /var/run/docker.sock:/var/run/docker.sock
     - ~/docker/elk/logs/kafka:/kafka
    depends_on:
     - zoo1
    networks:
     - esnet
  

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

networks:
  esnet:

docker-compose.yml

posted @ 2020-07-09 08:47  十三燕  阅读(155)  评论(0编辑  收藏  举报