ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • docker 로 elasticsearch 7 설치
    docker 2023. 11. 21. 15:22

    환경 설정

    sudo apt-get install docker-compose
     
    sudo sysctl -w fs.file-max=262114
    sudo sysctl -w  vm.max_map_count=1048575

     

    디렉토리 구성

    3개의 nodes 로 구성하고, 각각의 LOCAL 저장소 위치를 다음과 같이 사용한다면

    • /home/windbird/opt/elasticsearch/data/es01
    • /home/windbird/opt/elasticsearch/data/es02   
    • /home/windbird/opt/elasticsearch/data/es03

    각각의 디렉토리 생성 후 아래와 같이 권한 설정함

    chown -R 1000:root /home/windbird/opt/elasticsearch/data/es01
    chown -R 1000:root /home/windbird/opt/elasticsearch/data/es02
    chown -R 1000:root /home/windbird/opt/elasticsearch/data/es03

     

    docker-compose.yml 

    아래의 ES_JAVA_OPTS 에서 node 마다 16GB 메모리를 사용하도록 설정했는데, 필요에 따라 조정한다.

     version: '2.2'
     services:
       es01:
         image: docker.elastic.co/elasticsearch/elasticsearch:7.3.2
         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=-Xms16g -Xmx16g"
         ulimits:
           memlock:
             soft: -1
             hard: -1
         volumes:
           - /home/windbird/opt/elasticsearch/data/es01:/usr/share/elasticsearch/data
         ports:
           - 9200:9200
         networks:
           - elastic
       es02:
         image: docker.elastic.co/elasticsearch/elasticsearch:7.3.2
         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=-Xms16g -Xmx16g"
         ulimits:
           memlock:
             soft: -1
             hard: -1
         volumes:
           - /home/windbird/opt/elasticsearch/data/es02:/usr/share/elasticsearch/data
         networks:
           - elastic
    
       es03:
         image: docker.elastic.co/elasticsearch/elasticsearch:7.3.2
         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=-Xms16g -Xmx16g"
         ulimits:
           memlock:
             soft: -1
             hard: -1
         volumes:
           - /home/windbird/opt/elasticsearch/data/es03:/usr/share/elasticsearch/data
         networks:
           - elastic
    
       kibana:
         container_name: kibana
         image: docker.elastic.co/kibana/kibana:7.3.2
         environment:
           - SERVER_NAME=kibana
           - ELASTICSEARCH_HOSTS=http://es01:9200
         ports:
           - "5601:5601"
         networks:
           - elastic
         depends_on:
           - es01
           - es02
           - es03
    
     networks:
       elastic:

     

    실행

     sudo docker-compose up
     # sudo docker-compose down

     

    확인

    Elasticsearch

    http://localhost:9200/_cluster/health
    http://localhost:9200/_cat/nodes?v
    http://localhost:9200/_cat/indices?v

    Kibana

    http://localhost:5601/

     

    'docker' 카테고리의 다른 글

    container 간 통신  (0) 2024.03.28
    docker 로 jupyter lab 설치하기  (0) 2024.01.04
    docker error "TLS handshake timeout"  (0) 2022.06.24
    docker 로 kafka 설치  (0) 2021.12.22
    docker 로 mysql 설치하고 접속하기  (0) 2021.11.07

    댓글

Designed by Tistory.