database by narae :p

도커 + ELK 분산 환경 셋팅 본문

개발 노트

도커 + ELK 분산 환경 셋팅

dbbymoon 2020. 5. 24. 14:51

# 단일 서버 

git clone https://github.com/deviantony/docker-elk.git
cd docker-elk
vi elasticsearch/config/elasticsearch.yml

xpack.security.enabled: false

 

docker stack deploy -c docker-stack.yml elk
docker ps
docker service ls

 


 

## 레플리카 모드 

 

vi docker-stack.yml

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    ports:
      - "9200"
      - "9300"
    configs:
      - source: elastic_config
        target: /usr/share/elasticsearch/config/elasticsearch.yml
    environment:
      cluster.name: "docker-cluster"
      node.name: elk_elasticsearch.{{.Task.Slot}}
      discovery.seed_hosts: tasks.elasticsearch
      cluster.initial_master_nodes: elk_elasticsearch.1,elk_elasticsearch.2,elk_elasticsearch.3
      node.master: "true"
      node.data: "true"
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
      ELASTIC_PASSWORD: changeme
    networks:
      - elk
    deploy:
      mode: replicated
      replicas: 3
vi elasticsearch/config/elasticsearch.yml

network.host: [ _eth0_, _eth1_, _lo_ ]
network.publish_host: _eth0_
sudo sysctl -w vm.max_map_count=262144

 


 

## 글로벌 모드

vi docker-stack.yml

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    hostname: elasticsearch-{{.Node.Hostname}}
    ports:
      - "9200:9200"
      - "9300:9300"
    configs:
      - source: elastic_config
        target: /usr/share/elasticsearch/config/elasticsearch.yml
    environment:
      cluster.name: "docker-cluster"
      node.name: elasticsearch-{{.Node.Hostname}}
      discovery.seed_hosts: elasticsearch
      cluster.initial_master_nodes: elasticsearch-laptop
      node.master: "true"
      node.data: "true"
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
      ELASTIC_PASSWORD: changeme
    networks:
      - elk
    deploy:
      mode: global

'개발 노트' 카테고리의 다른 글

JPA 연관 관계가 있는 엔티티 생성 패턴  (0) 2023.03.09
JPA @OneToMany - targetEntity  (0) 2023.03.09
도커 Docker 정리 1  (0) 2020.05.16
더블 디스패치 double dispatch  (0) 2020.01.07
user level lock  (0) 2019.06.12