본문 바로가기
ELK Stack

Docker에서 ELK 돌려보기 (ubuntu기준)

by BeGeek 2021. 10. 20.

ubuntu에 Docker 및 ELK를 설치하고 돌려보자.

 

참고자료>

구글에서 running elastic stack on docker 키워드로 검색 또는 아래 링크 클릭!

Running the Elastic Stack on Docker | Getting Started [7.15] | Elastic

 

Running the Elastic Stack on Docker | Getting Started [7.15] | Elastic

At this point, Kibana cannot connect to the Elasticsearch cluster. You must generate a password for the built-in kibana_system user, update the ELASTICSEARCH_PASSWORD in the compose file, and restart to enable Kibana to communicate with the secured cluster

www.elastic.co

 

ubuntu 접속 후 업데이트

sudo apt update 수행(업데이트 안될 경우 sudo reboot 을 해줌.자원리셋되고 수행 될 수 있도록...)

 

Docker설치

sudo apt install docker.io

 

Docker-Compose 설치

sudo apt install docker-compose

 

Docker-Compose.yml 작성

vi docker-compose.yml

version: '2.0'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.15.1
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    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.15.1
    container_name: es02
    environment:
      - node.name=es02
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data02:/usr/share/elasticsearch/data
    networks:
      - elastic

  es03:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.15.1
    container_name: es03
    environment:
      - node.name=es03
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es02
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data03:/usr/share/elasticsearch/data
    networks:
      - elastic

  kib01:
    image: docker.elastic.co/kibana/kibana:7.15.1
    container_name: kib01
    ports:
      - 5601:5601
    environment:
      ELASTICSEARCH_URL: http://es01:9200
      ELASTICSEARCH_HOSTS: '["http://es01:9200","http://es02:9200","http://es03:9200"]'
    networks:
      - elastic

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

networks:
  elastic:
    driver: bridge

Docker-Compose 및 ELK설치

sudo VERSION=7.4.1 docker-compose up

'ELK Stack' 카테고리의 다른 글

filebeat, logstash 설정  (0) 2021.10.20
logstash 사용  (0) 2021.10.20

댓글