GW LABS

기초부터 다지는 ElasticSearch 운영 노하우 (1) - ElasticSearch 훑어보기 본문

Book-Review/Programing

기초부터 다지는 ElasticSearch 운영 노하우 (1) - ElasticSearch 훑어보기

GeonWoo Kim 2022. 8. 23. 11:01

1.1 ElasticSearch란

  • 루씬 기반의 오픈 소스 검색 엔진
  • JSON 기반의 문서를 저장/검색/분석
  • 준실시간 검색 엔진
    • 문서를 메모리에 저장
    • refresh_interval 시간에 따라 Shard에 문서를 저장
  • 클러스터 구성
    • 프라이머리/레플리카 샤드
    • 메시 형태기 떄문에 어떤 노드에서든 색인/검색 처리가능
  • 스키마리스
  • Rest API

 

Docker로 ElasticSearch 구성하기

version: '2.2'
services:
  my-es:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.3.3
    container_name: my-es
    environment:
      - node.name=my-es-node
      - cluster.name=my-es-cluster
      - discovery.type=single-node
      - discovery.seed_hosts=my-es-node
      - path.data=/usr/share/elasticsearch/data
      - path.logs=/usr/share/elasticsearch/logs
      - bootstrap.memory_lock=true
      - http.port=9200
      - transport.port=9300
      - transport.compress=true
      - network.host=0.0.0.0
      - http.cors.enabled=false
      - http.cors.allow-origin=/http?:\/\/localhost(:[0-9]+)?/
      - action.auto_create_index=true
      - action.destructive_requires_name=true
      - cluster.routing.use_adaptive_replica_selection=true
      - http.compression=true
      - http.compression_level=3
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      
      # SSL, 인증기능 비활성화
      - xpack.security.enabled=false
      - xpack.security.enrollment.enabled=false
      - xpack.security.transport.ssl.enabled=false
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nproc:
        soft: 1024000
        hard: 1024000
      nofile:
        soft: 1024000
        hard: 1024000
    sysctls:
      net.core.somaxconn: 65000
    healthcheck:
      test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cat/health || exit 1"]
      interval: 30s
      timeout: 30s
      retries: 3
    restart: always
    volumes:
      - my-volume-data:/usr/share/elasticsearch/data:rw
      - my-volume-log:/usr/share/elasticsearch/logs:rw
    ports:
      - 9200:9200
      - 9300:9300
    expose:
      - 9200
      - 9300
    networks:
      - my-es-network

volumes:
  my-volume-data:
    driver: local
  my-volume-log:
    driver: local

networks:
  my-es-network:
    driver: bridge
Comments