레이블이 Elasticsearch인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Elasticsearch인 게시물을 표시합니다. 모든 게시물 표시

Elasticsearch Configuration

Elasticsearch Configuration

Environment Variables 

- EL은 자바의 환경변수 JAVA_OPTS에 따른다.
- 가장 중요한 환경 설정값은 -Xmx (최대 메모리),  -Xms (최소메모리) 의 설정이다.
- 대부분 JAVA_OPTS는 그대로 두고, ES_JAVA_OPTS를 설정하여 JVM의 환경변수를 변경한다.
- ES_HEAP_SIZE 환경 변수는 힙 메모리를 설정하는 값이다.
    - 이 설정값을 설정하면 ES_MIN_MEM(기본 256m), ES_MAX_MEM(기본 1g)을 같은 값으로 설정한다.
# 추천 :
  - 값은 min과 max를 동일하게 하는것
  - mlockall enable로 설정하기.

System Configuration 

File Descriptors

- 머신에서 설정된 open file의 수를 다음으로 증가 시킨다. 32k --> 64k (추천)
- 얼마나 많은 수의 파일이 오픈 될 수 있는지 설정을 한다.
    -Des.max-open-files=true
- 이렇게 설정하면 엘라스틱 서치가 올라올때 최대 오픈할 수 있는 파일 수를 프린트한다.
- 다른 방법으로는 엘라서틱 질의를 통해서 max_file_descriptors를 확인할 수 있다.
curl localhost:9200/_nodes/process?pretty

Virtual memory 

Elasticsearch는 인덱스 저장을 위해서 hybrid mmaps / niofs 디렉토리를 기본으로 사용한다.
  * niofs : 파일시스템에 샤드 인덱스를 NIO를 이용하여 저장한다. 멀티 쓰레드가 동시에 동일한 파일을 읽을 수 있도록 지원한다. Windows에서는 사용하지 않도록 권고한다. Java 구현체에 버그가 있다.
  * mmaps : 파일스스템에 샤드 인덱스를 memory에 파일을 매핑하는 방식으로 저장한다. 메모리 매핑은 파일 크기와 동일한 가상메모리 공간을 이용한다.

기본 OS의 제약은 mmap에 그대로 적용되며, 너무 아래로 떨어지게 되면 out of memory 예외가 발생한다. Linux에서는 다음 명령어를 통해서 제한 값을 올릴 수 있다.
sysctl -w vm.max_map_count=262144
이 값을 영구적으로 설정하기 위해서는 vm.max.map_count 설정을 /etc/sysctl.conf 에 지정하자.
root계정으로만 가능하다.
  * 만약 .deb, .rpm으로 Elasticsearch를 설치한경우라면 이 값은 자동으로 설정된다.

Memory Settings 

대부분의 운영 체제는 시스템 캐시를 위해 가능한 많은 메모리를 사용하고자 한다. 그리고 어플리케이션에서 사용하지 않는 메모리는 swap out 하고자 시도한다. 엘라스틱 서치의 프로세스도 swap이 될 수 있다.
Swapping은 노드의 안정성을 유지하기 위해서 성능을 심각하게 떨어뜨리게 된다. 이러한 swap를 피하는 것이 좋다.

Disable swap 

가장 단순한 옵션으로 swap를 완젼히 정지 시킨다. 일반적으로 EL은 box에서 서비스를 수행하고, ES_HEAP_SIZE에 의해서 컨트롤 된다. swap를 enable로 설정할 필요가 없다.
리눅스 시스템에서 다음 명령어를 통해서 swap를 임시로 끌 수 있다.
sudo swapoff -a 
영구적으로 끄기 위해서는 /etc/fstab를 수정하고, swap로 된 모든 라인을 커멘트 처리 하면 된다.
Windows에서는 다음 경로에서 disable할 수 있다.
System Properties -> Advanced -> Performance -> Advanced -> Virtual memory

Configure swappiness 

두번째 옵션은 sysctl 값인 vm.swappiness를 0으로 설정하는 방법이다.
이것은 커널이 swap 하고자 하는 경향을 줄여주고, 일반적인 환경에서는 swap를 수행하지 않도록 해준다. 긴급 상황에서만 swap를 수행한다.

# 참고 : 커널버젼 3.5-rc1 이상 버젼에서는 swappiness의 값을 0으로 설정하면 OOM killer 가 나타나면 swapping을 수행하는 대신에 해당 프로세스를 kill한다. swappiness 를 1로 설정하면 swapping을 수행한다.

mlockall

이 옵션은 mlockall을 이용하며  Linux / Unix시스템의 기능을 이용한다.  혹은 윈도우에서는 VirtualLock 기능을 이용한다.
이것은 RAM의 공간에 lock을 거는 방법으로 Elasticsearch 메모리가 swapped out되는 것을 막아준다. 이것은 config/elasticsearch.yml 파일에 다음과 같이 정의하는 것으로 설정이 가능하다.
bootstrap.mlockall: true
Elasticsearch가 실행된후 해당 옵션이 성공적으로 적용되었는지 확인은 다음과 같이 수행할 수 있다.
curl http://localhost:9200/_nodes/process?pretty
만약 mlockall이 false로 설정 되어 있다면 mlockall요청이 실패 했음을 의미한다. 이 이유는 Linux/Unix시스템에서 EL이 메모리 lock권한을 가지고 있지 않은 경우 발생한다.
이것은 ulimit -l unlimited 값을 root권한으로 지정하면 가능하다.
mlockall이 실패할 수 있는 또 다른 이유는 /tmp 디렉토리가 noexec옵션으로 마운트 된 경우에 가능성이 있다. 이것은 Elasticsearch를 실행할때 옵션을 선택하여 temp 위치를 변경하는 것으로 해결이 가능하다.
./bin/elasticsearch -Djna.tmpdir=/path/to/new/dir
# mlockall은 JVM이나 shell session을 종료시킬 수 있는데 이것은 가용한 용량보다 더 많은 메모리를 할당하고자 하는 경우 발생될 수 있다.

Elasticsearch Settings

elasticsearch설정 파일은 ES_HOME/config 폴더 아래에 있다. 폴더는 2개의 파일이 있으며, elasticsearch.yml로 Elasticsearch 설정을 하기 위한 파일과, logging.yml로 로기을 설정하기 위함이다.

설정 포맷은 YAML로 되어 있다.

다음은 모든 Base module들의 네트워크를 변경하는 것으로 바인드 시키고 publish를 해준다.
network :
    host : 10.0.0.4

 Paths

사용 환경에서 데이터의 위치와 로그 파일의 위치를 지정하고자 하는 니즈가 있을 것이다.
path :
    logs: /var/log/elasticsearch
    data: /var/data/elasticsearch

Cluster name

실제 환경에서는 절대로 클러스터 이름을 지정하는 것을 빼먹지 말자. 이것은 discover과 auto-join을 위해서 꼭 필요하다.
cluster:
    name: <NAME OF YOUR CLUSTER>
서로다른 환경에서 동일 클러스터 이름을 사용하지 않도록 주의하자. 그렇지 않으면 잘못된 클러스터에 노드가 조인된다. 예를 들면 logging-dev, logging-stage, logging-prod와 같이 클러스터를 나누자.

Node name

기본 노드 이름을 변경하고자 할수도 있다. 각 노드는 노출되는 호스트의 이름이 된다. 기본적으로 Elasticsearch는 랜덤하게 지정된다.
node:
    name: <NAME OF YOUT NODE>
머신의 호스트 이름은 환경 변수 HOSTNAME에 지정된 내역을 따른다. 만약 머신에 하나의 엘라스틱 서치 노드를 수행시킨다면 ${...}을 이용하여 호스트 이름을 지정할 수 있다.
node:
    name: ${HOSTNAME}
내부적으로 모든 설정은 namespaced 구조로 설정된다.
예를 들어 이전에 설명한 node.name으로 지정하여 설정할 수 있다. 이 의미는 설정을 JSON형식으로 쉽게 지정할 수 있다. 만약 JSON형식으로 처리하고자 한다면 elasticsearch.yml을 elasticsearch.json으로 변경하면 된다.

Configuration styles

{
    "network" : {
        "host" : "10.0.0.4"
    }
}
이것은 외부 설정인 ES_JAVA_OPTS를 이용하여 설정할 수 있다.
elasticsearch -Des.network.host=10.0.0.4
다른 옵션은 es.default 이다. prefix가 es.이며 이는 기본 설정을 의미한다. 이값은 명시적으로 설정파일에 지정하지 않으면 기본값으로 설정된다는 의미이다.

다른 옵션은 ${...}을 이용하는 것으로 이것은 환경 변수로 설정된 값을 이용한다.
{
    "network" : {
        "host" : "${ES_NET_HOST}"
    }
}
추가적으로 설정파일에 내역을 저장하지 않고자 한다면 ${prompt.text}혹은 ${prompt.secret} 을 이용할 수 있다. 이는 foreground로 설정값을 입력하라고 묻게 된다.
${prompt.secret} 는 터미널로 입력 하도록 물어본다.
node:
    name: ${prompt.text}
elasticsearch 커맨드를 실행하면 다음과 같은 프롬프트 화면을 보게 된다.
Enter value for [node.name]
# Elasticsearch는 ${prompt.text}혹은 ${prompt.secret}을 설정했을때 백그라운드로 실행하면 elasticsearch는 정상적으로 시작되지 않는다.

Index Settings

인덱스들이 생성되면 각 자신들의 설정을 제공할 수 있다. 예를 들어 다음은 인덱스를 메모리 기반의 저장소로 생성한다. 파일시스템을 생성하지 않고 말이다. 포맷은 YAML이나 JSON으로 지정이 가능하다.
$ curl -XPUT http://localhost:9200/kimchy/ -d \
'
index:
    refresh_interval: 5s
'
인덱스 레벨 설정은 node레벨과 같이 설정이 가능하다. 예를 들어 elasticsearch.yml파일에서 다음과 같이 지정할 수 있다.
index :
    refresh_interval: 5s
이것이 의미하는 바는 각 인덱스는 실행된 특정 노드에서 생성된 것을 획득하며, 이것은 시작시 특별히 지정하지 않으면 설정에 따라 메모리에 인덱스를 저장하게 될 것이다. 즉, 인덱스 레벨의 설정은 노드 설정에 지정된 값을 오버라이딩 한다. 물론 상단 예는 설정의 일부분이다.
$ elasticsearch -Des.index.refresh_interval=5s
모든 인덱스 레벨의 설정값은 각 인덱스 모듈에서 찾을 수 있다.

Loggin 

Elasticsearch는 내부 로깅을 위한 추상화를 제공한다. log4j를 이용한다. 이것은 log4j 설정을 통해서 가능하며 YAML을 이용하여 설정한다. 그리고 로깅 설정 파일은 config/logging.yml 에 지정이 가능하다.
JSON과 properties 포맷도 지정이 가능하다. 로깅 설정 파일은 여러개를 로드 할 수 있다. 이들은 시작시에 하나로 머지된다.
logger 섹션은 자바 패키지를 포함하고 있다. 그리고 각 해당하는 로그 레벨을 지정을 할 수 있다. 이것은 org.elasticsearch 프리픽스를 사용하지 않아도 되도록 한다.
appender 섹션은 로그들의 목적지를 포함한다.

Deprecation logging

추가적으로 elasticsearch는 deprecated된 액션의 로깅을 가능하게 한다. 예를 들어 앞으로 특정 기능을 이관할 필요가 있을때 미리 결정할 수 있도록 해준다. 기본적으로 deprecation로깅은 disabled되어 있다. config/logging.yml파일 에서 DEBUG로 로그 레벨을 설정할 수 있다.
deprecation: DEBUG, deprecation_log_file
이것은 일별 롤링 로그 파일을 로그 디렉토리에 생성한다.

from : https://www.elastic.co/guide/en/elasticsearch/reference/2.1/setup-configuration.html












ElasticSearch 설치 on Mac

ElasticSearch 설치 on Mac

엘라스틱 서치를 Mac 에 설치하기. 

1. brew인스톨 하기. 

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. elasticsearch 설치하기. 


brew install homebrew/versions/elasticsearch14

3. elasticsearch 실행하기. 

elasticsearch --config=/usr/local/opt/elasticsearch14/config/elasticsearch.yml


4. Shards 와 replicas 조정하기


curl -X PUT "localhost:9200/news" -d '{"setting":{"index":{"number_of_shards":2, "number_of_replicas":1}}}'
{"acknowledged":true}
A. Shard개수를 늘이면 : 
  - 쓰기 속도 향상
  - 인덱스 throughtout이 향상됨
B. Replicas개수를 늘이면 : 
  - 인덱스의 영속성이 증가됨 (즉, 저장 안정성이 올라감)
  - 읽기 throughtout이 향상됨
  - 그러나 디스크 스페이스는 많이 필요로함. 

5. 설정파일 분석 


##################### Elasticsearch Configuration Example #####################



# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
# 이 파일은 다양한 설정 전체를 포함하고 있다. 
# 어플리케이션 개발자는 <http://elasticsearch.org/guide>를 참고하기 바란다. 
#

# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
# 인스톨 과정은 아래 경로에서 확인해보자. 
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.


# Elasticsearch comes with reasonable defaults for most settings,
# so you can try it out without bothering with configuration.
# Elasticsearch 는 대부분의 의미있는 기본 설정을 지정한다. 
# 그러므로 설정을 어렵지 않게 조정할 수 있다. 

#
# Most of the time, these defaults are just fine for running a production
# cluster. If you're fine-tuning your cluster, or wondering about the
# effect of certain configuration option, please _do ask_ on the
# mailing list or IRC channel [http://elasticsearch.org/community].
# 대부분 이런 기본 설정들로 실제 사용할 클러스터들에 적용할 수 있다. 
# 만약 클러스터 튜닝을 좀더 잘 하고자 하거나, 특정 설정 옵션의 기능에 대해서 알고자 한다면 메일링 리스트
# [http://elasticsearch.org/community] 로 혹은 IRC채널로 문의 바란다. 

# Any element in the configuration can be replaced with environment variables
# by placing them in ${...} notation. For example:
#node.rack: ${RACK_ENV_VAR}
#
# 설정에 존재하는 엘리먼트는 환경 변수로 대체할 수 있다. ${...} 표기법을 이용하면 되며 다음 예와 같이 적용할 수 있다.
#node.rack: ${RACK_ENV_VAR}

# For information on supported formats and syntax for the config file, see
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup-configuration.html>
# 지원되는 포맷과 문법에 대해서 정보를 얻고자 한다면 다음 경로에서 찾아보자. 
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup-configuration.html>

################################### Cluster [클러스터 설정] ###################################

# Cluster name identifies your cluster for auto-discovery. If you're running
# multiple clusters on the same network, make sure you're using unique names.
#
# 클러스터 이름은 자동으로 검색이될 클러스터의 이름을 지정하는 곳이다. 
# 만약 복수개의 클러스터를 동일한 네트워크에서 사용한다면 유니크한 이름을 사용하는 것이 좋다. 

cluster.name: elasticsearch_KIDO


#################################### Node #####################################

# Node names are generated dynamically on startup, so you're relieved
# from configuring them manually. You can tie this node to a specific name:
#
# Node 이름들은 실행될때 동적으로 생성된다. 그러므로 수동으로 직접 설정하지 않아도 된다. 
# 이 노드 이름을 직접 아래와 같이 지정해도 된다. 
#node.name: "Franz Kafka"

# Every node can be configured to allow or deny being eligible as the master,
# and to allow or deny to store the data.
# 각 노드는 allow혹은 deny로 설정이 가능하다. 이것은 마스터의 자격을 가질지 지정하는 것이다. 
# 그리고 데이터를 저장할지 여부도 결정할 수 있다. 

# Allow this node to be eligible as a master node (enabled by default):
# 아래는 노드를 마스터로 지정될 수 있도록 설정하고 있다. (enabled가 기본값이다.)
#node.master: true
#
# Allow this node to store data (enabled by default):
# 아래는 데이터를 저장할지 여부를 지정한다. (enabled가 기본값이다.)
#node.data: true

# You can exploit these settings to design advanced cluster topologies.
# 아래 설정은 향상된 클러스터 토폴로지 설계를 위해 이용하는 것이다. 

# 1. You want this node to never become a master node, only to hold data.
#    This will be the "workhorse" of your cluster.
# 1. 만약 이 노드를 절대 마스터 노드로 지정하고 싶지 않고, 데이터만 저장하는 것으로 지정하는 경우라면 다음과 같다.
# 이는 "workhorse" 로 만드는 것이다. 
#
#node.master: false
#node.data: true
#
# 2. You want this node to only serve as a master: to not store any data and
#    to have free resources. This will be the "coordinator" of your cluster.
# 2. 이 노드를 오직 마스터 서버로만 사용하고자 할때 적용할 수 있다. 데이터를 저장하지 않고, free리소스를 가지는 경우 설정이다.
# 이것은 "coordinator" 로 만든다.  
#node.master: true
#node.data: false
#
# 3. You want this node to be neither master nor data node, but
#    to act as a "search load balancer" (fetching data from nodes,
#    aggregating results, etc.)
# 3. 만약 마스터 노드도 아니고 데이터 노드도 아니게 만들수 있다. 그러나 "search load balancer"로 지정할 수 있다.
# 노드에서 데이터를 패치하고 결과를 집계하는 용도로 사용할 수 있다. 
#node.master: false
#node.data: false

# Use the Cluster Health API [http://localhost:9200/_cluster/health], the
# Node Info API [http://localhost:9200/_nodes] or GUI tools
# such as <http://www.elasticsearch.org/overview/marvel/>,
# <http://github.com/karmi/elasticsearch-paramedic>,
# <http://github.com/lukas-vlcek/bigdesk> and
# <http://mobz.github.com/elasticsearch-head> to inspect the cluster state.

# Cluster Health API를 이용하는 것 [http://localhost:9200/_cluster/health], 
# 노드 정보 API [http://localhost:9200/_nodes] 혹은
# GUI 툴 <http://www.elasticsearch.org/overview/marvel/>, 
# <http://github.com/karmi/elasticsearch-paramedic>,
# <http://github.com/lukas-vlcek/bigdesk> and
# <http://mobz.github.com/elasticsearch-head> 는 클러스터의 상태를 인스펙트 할 수 있다. 

# A node can have generic attributes associated with it, which can later be used
# for customized shard allocation filtering, or allocation awareness. An attribute
# is a simple key value pair, similar to node.key: value, here is an example:

# 노드는 generic어트리뷰트를 가지고 연계할 수 있다. 이것은 나중에 샤드 할당 필터링으로 이용할 수 있거나
# 혹은 allocation 인식등에 이용된다. 
# attribute는 단순한 key, value쌍으로 구성한다. 이는 node.key: value형태와 유사하다. 
#node.rack: rack314

# By default, multiple nodes are allowed to start from the same installation location
# to disable it, set the following:
# 기본적으로 복수 노드들은 동일한 설이 위치부터, disable 가 되는 것까지 다음처럼 설정할 수 있따. 
#node.max_local_storage_nodes: 1


#################################### Index 인덱스  ####################################

# You can set a number of options (such as shard/replica options, mapping
# or analyzer definitions, translog settings, ...) for indices globally,
# in this file.
# 다음 몇가지 옵션들을 설정할 수 있다. (shart/replica옵션과 같이, 매핑 혹은 분석 정의를 할 수 있다. 또는 설정 변환등..)
# 글로벌 인덱스 설정은 이 파일에서 지정이 가능하다. 
#
# Note, that it makes more sense to configure index settings specifically for
# a certain index, either when creating it or by using the index templates API.
# 노트, 하나의 인덱스를 특별한 인덱스로 설정할 수 있게 만들수 있다. 인덱스를 생성하거나, 인덱스 템플릿 API를 생성하는 것도 가능하다. 
#
# See <http://elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules.html> and
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html>
# for more information.

# Set the number of shards (splits) of an index (5 by default):
# 인덱스의 shart의 개수를 지정한다. 5가 기본값이다. 
#index.number_of_shards: 5

# Set the number of replicas (additional copies) of an index (1 by default):
# 인덱스의 복제 계수를 지정한다. 1이 기본값이다. 
#index.number_of_replicas: 1

# Note, that for development on a local machine, with small indices, it usually
# makes sense to "disable" the distributed features:
# 노트, 로컬 머신에서 개발을 할때에는 작은 인덱스를 지정하고, 보통 분산 기능을 "disable"로 지정한다. 
#index.number_of_shards: 1
#index.number_of_replicas: 0

# These settings directly affect the performance of index and search operations
# in your cluster. Assuming you have enough machines to hold shards and
# replicas, the rule of thumb is:
# 이 세팅들은 인덱스와 검색 오퍼레이션의 성능에 직접적인 영향을 주는 것이다. 
# 샤드를 홀딩하고 복제를 위한 충분한 머신이 있다고 가정하면 이러한 룰을 적용할 수 있다. 
#
# 1. Having more *shards* enhances the _indexing_ performance and allows to
#    _distribute_ a big index across machines.
# 1. *shards* 를 많이 가지면 _indexing_ 성능을 향상하고, 큰 인덱스들을 머신에걸쳐 분산할 수 있다. 
# 2. Having more *replicas* enhances the _search_ performance and improves the
#    cluster _availability_.
 # 2. 더 많은 *replicas*를 가지면 _search_성능을 향상하고, 클러스터의 가용성을 더 올릴수 있다. 
#
# The "number_of_shards" is a one-time setting for an index.
# "number_of_shards"는 하나의 인덱스에 대한 한번의 세팅이다. 
#
# The "number_of_replicas" can be increased or decreased anytime,
# by using the Index Update Settings API.
# "number_of_replicas"는 언제든지 증가되거나 감소될수 있다. 이것은 인덱스 업데이트 설정 API를 이용하면 된다. 

# Elasticsearch takes care about load balancing, relocating, gathering the
# results from nodes, etc. Experiment with different settings to fine-tune
# your setup.
# Elasticsearch는 로드 밸런싱, 재할당, 노드 결과 수집 등등을 수행할 수 있다. 
# 설정을 통해서 적합한 설정을 실험해 볼 수 있다. 

# Use the Index Status API (<http://localhost:9200/A/_status>) to inspect
# the index status.
# Indes Status API를 (<http://localhost:9200/A/_status>) 이용하여 인덱스의 상태를 확인할 수 있다.  


#################################### Paths ####################################

# Path to directory containing configuration (this file and logging.yml):
# Path는 설정이 있는 경로를 나타낸다. (이 파일과 logging.yml)이 그것이다. 
#path.conf: /path/to/conf

# Path to directory where to store index data allocated for this node.
# Path 인덱스 데이터를 이 노드에 어디에 할당할지를 지정한다. 
path.data: /usr/local/var/elasticsearch/
#
# Can optionally include more than one location, causing data to be striped across
# the locations (a la RAID 0) on a file level, favouring locations with most free
# space on creation. For example:
# 산텍적으로 하나 이상의 설정을 지정할 수 있다. 이것은 로케이션을 거쳐서 스트라이프 하도록 데이터를 지정할 수 있다. (RAID 0) 참조
# 대부분 빈 공간으로 설정되도록 하는 것이 좋다. 
#
#path.data: /path/to/data1,/path/to/data2

# Path to temporary files:
# Path : 임시 파일 
#path.work: /path/to/work

# Path to log files:
# Path : 로그 파일 
path.logs: /usr/local/var/log/elasticsearch/

# Path to where plugins are installed:
# Path : 플러그인이 인스톨된 위치
path.plugins: /usr/local/var/lib/elasticsearch/plugins

#################################### Plugin ###################################

# If a plugin listed here is not installed for current node, the node will not start.
# 만약 나열된 플러그인이 현재 노드에 설치되어 있지 않은경우 노드는 시작하지 않는다. 
#plugin.mandatory: mapper-attachments,lang-groovy


################################### Memory ####################################

# Elasticsearch performs poorly when JVM starts swapping: you should ensure that
# it _never_ swaps.
# Elasticsearch는 JVM swapping이 시작되면 성능이 형편없이 떨어진다. 그러므로 반드시 _never_ swaps로 지정해야한다.
#
# Set this property to true to lock the memory:
# 이 프로퍼티는 메모리 락을 true로 설정하는 것이다. 
#bootstrap.mlockall: true

# Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set
# to the same value, and that the machine has enough memory to allocate
# for Elasticsearch, leaving enough memory for the operating system itself.
# ES_MIN_MEM과 WS_MAX_MEM 환경 변수가 동일한 값으로 설정되어 있는지 확인한다. 그리고 장비가 elasticsearch를 위해
# 메모리를 충분히 할당하였는지 운영체제 자체를 위해 충분한 메모리를 남겨 두었는지 확인하자. 

# You should also make sure that the Elasticsearch process is allowed to lock
# the memory, eg. by using `ulimit -l unlimited`.
# 또한 elasticsearch가 메모리 락을 걸수 있도록 설정되어 있는지 확인하자. 
# `ulimit -l unlimited`를 이용한다. 


############################## Network And HTTP ###############################

# Elasticsearch, by default, binds itself to the 0.0.0.0 address, and listens
# on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node
# communication. (the range means that if the port is busy, it will automatically
# try the next port).
# Elasticsearch는 기본적으로 0.0.0.0 주소로 바인딩 된다. 그리고 포트번호 9200-9300는 HTTP트래픽을 을 리슨한다.
# 9300-9400은 node-to-node커뮤니케이션 용으로 사용된다. (range는 포트가 바쁜경우 자동적으로 다음 포트로 할당되도록 한다.)

# Set the bind address specifically (IPv4 or IPv6):
# 바인드 주소를 지정할 수 있다. (IPv4, IPv6)
#network.bind_host: 192.168.0.1

# Set the address other nodes will use to communicate with this node. If not
# set, it is automatically derived. It must point to an actual IP address.
# 노드와 커뮤니케이션 할 수 있도록 주소를 설정한다. 만약 설정하지 않는다면 자동으로 만들어 진다. 
# 이는 반드시 유효한 IP주소에 할당 되어야 한다. 
#network.publish_host: 192.168.0.1

# Set both 'bind_host' and 'publish_host':
# 'bind_host'와 'publish_host' 둘다 설정한다. 
network.host: 127.0.0.1

# Set a custom port for the node to node communication (9300 by default):
# 커스텀 포트를 설정하여 node to node간 통신을 하도록 한다. (9300은 기본값임)
#transport.tcp.port: 9300

# Enable compression for all communication between nodes (disabled by default):
# 노드간 통신을 압축할지 지정한다. (disabled가 기본값이다.)
#transport.tcp.compress: true

# Set a custom port to listen for HTTP traffic:
# HTTP트래픽을 위한 커스텀 포트를 지정한다. 
#http.port: 9200

# Set a custom allowed content length:
# 허용하는 컨텍스트의 크기를 지정한다. 
#http.max_content_length: 100mb

# Disable HTTP completely:
# HTTP 를 완젼히 disable하게 만든다. 
#http.enabled: false


################################### Gateway ###################################

# The gateway allows for persisting the cluster state between full cluster
# restarts. Every change to the state (such as adding an index) will be stored
# in the gateway, and when the cluster starts up for the first time,
# it will read its state from the gateway.
# gateway는 전체 클러스터들간의 상태를 저장하도록 허용한다. 각 변경은 gateway에 저장된다. (인덱스 포함) 
# 그리고 클러스터는 첫번째에 시작되고 gateway로 부터 상태를 읽을 수 있게 된다. 

# There are several types of gateway implementations. For more information, see
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-gateway.html>.
# gateway 구현에 대한 몇가지 타입에 대한 정보를 보고자 한다면 다음을 참조하자. 
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-gateway.html>.

# The default gateway type is the "local" gateway (recommended):
# 기본 gateway는 "local" gateway이며 (추천한다)
#gateway.type: local

# Settings below control how and when to start the initial recovery process on
# a full cluster restart (to reuse as much local data as possible when using shared
# gateway).
# 아래 컨트롤을 어떻게 언제 전체 클러스터 재시작시 복구 프로세스를 시작할지 설정한다. (gateway를 공유할때 가능한한 로컬 데이터를 이용한다.)

# Allow recovery process after N nodes in a cluster are up:
# 복구 프로세스를 허용하여 N개 노드 클러스터가 업된 후에 처리된다. 
#gateway.recover_after_nodes: 1

# Set the timeout to initiate the recovery process, once the N nodes
# from previous setting are up (accepts time value):
# 초기 복구 프로세스의 타임아웃을 설정한다. 이느 이전 설정이 올라가고부터 지정되는 값이다. 
#gateway.recover_after_time: 5m

# Set how many nodes are expected in this cluster. Once these N nodes
# are up (and recover_after_nodes is met), begin recovery process immediately
# (without waiting for recover_after_time to expire):
# 얼마나 많은 노드가 이 클러스터를 기대하는지 설정한다. N노드들이 올라가고, 복구프로세스는 즉시 수행된다. 
# (expire이후 recover를 기다리지 않고)
#gateway.expected_nodes: 2


############################# Recovery Throttling #############################

# These settings allow to control the process of shards allocation between
# nodes during initial recovery, replica allocation, rebalancing,
# or when adding and removing nodes.
# 이 설정들은 노드들이 초기화 복구를 수행, 복제 할당, 리밸런싱, 노드의 삭제, 추가등을 하는 동안에 샤드 할당 처리를 컨트롤 하도록 한다. 

# Set the number of concurrent recoveries happening on a node:
# 노드에 동시 복구처리될 개수를 지정한다. 
# 1. During the initial recovery
# 1. 초기복구 동안 
#cluster.routing.allocation.node_initial_primaries_recoveries: 4
#
# 2. During adding/removing nodes, rebalancing, etc
# 2. 노드를 추가/제거하는 동안 리팰런싱 동안. 
#
#cluster.routing.allocation.node_concurrent_recoveries: 2

# Set to throttle throughput when recovering (eg. 100mb, by default 20mb):
# 복구중에 throttle throughput설정 (예, 100mb, 기본은 20ms)
#indices.recovery.max_bytes_per_sec: 20mb

# Set to limit the number of open concurrent streams when
# recovering a shard from a peer:
# open concurrent stream의 수를 제한한다. 이때에는 각 피어로 부터 사드 복구가 수행될때 
#indices.recovery.concurrent_streams: 5


################################## Discovery ##################################

# Discovery infrastructure ensures nodes can be found within a cluster
# and master node is elected. Multicast discovery is the default.
# Discovery는 노드들이 클러스터를 찾을 수 있게 한다. 기본 discovery는 기본이다. 

# Set to ensure a node sees N other master eligible nodes to be considered
# operational within the cluster. This should be set to a quorum/majority of
# the master-eligible nodes in the cluster.
# 이 설정은 quorum/majority를 설정하는 것으로 마스터로 선출된 노드들을 설정한다. 
#discovery.zen.minimum_master_nodes: 1

# Set the time to wait for ping responses from other nodes when discovering.
# Set this option to a higher value on a slow or congested network
# to minimize discovery failures:
# 다른 노드로 부터 ping응답을 기다리는 시간을 설정한다. 이 설정을 높에 갑으면 
#discovery.zen.ping.timeout: 3s

# For more information, see
# 더 많은 정보를 보려면 
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html>

# Unicast discovery allows to explicitly control which nodes will be used
# to discover the cluster. It can be used when multicast is not present,
# or to restrict the cluster communication-wise.
# Unicast는 노드가 클러스터 복구를 수행되어지는 경우 명시적이 컨트롤이 되도록 한다.
# 이것은 몰티케스트가 없을때 혹은 클러스터 커뮤니케이션 방법에 제약이 갈때 이용될 수 있다. 
#
# 1. Disable multicast discovery (enabled by default):
# 1. 멀티캐스트 discovery를 disable한다. (기본값은 enabled이다. )
#discovery.zen.ping.multicast.enabled: false
#
# 2. Configure an initial list of master nodes in the cluster
#    to perform discovery when new nodes (master or data) are started:
# 2. 마스터 노드의 초기화 리스트의 설정을 통해서 클러스터내에 새로운 노드라 시작된경우 발견하도록 한다. 
#discovery.zen.ping.unicast.hosts: ["host1", "host2:port"]

# EC2 discovery allows to use AWS EC2 API in order to perform discovery.
# EC2 발견은 AWS EC2 API를 사용하도록 한다. 이는 discovery를 위해 사용된다. 
# You have to install the cloud-aws plugin for enabling the EC2 discovery.
# cloud-aws플러그인을 설치해야 EC2 discovery를 이용할 수 있다. 
# For more information, see
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-ec2.html>
#
#
# See <http://elasticsearch.org/tutorials/elasticsearch-on-ec2/>
# for a step-by-step tutorial.

# GCE discovery allows to use Google Compute Engine API in order to perform discovery.
# GCE discovery는 Google Compute Engine API를 이용하도록 해주며, discouvery를 수행한다. 
# You have to install the cloud-gce plugin for enabling the GCE discovery.
# cloud-gce플러그인을 설치해야 GCE discovery가 가능하다. 
#
# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-gce>.

# Azure discovery allows to use Azure API in order to perform discovery.
# Azure discovery는 Azure API를 발견하도록 허용한다. 
# You have to install the cloud-azure plugin for enabling the Azure discovery.
# cloud-azure플러그인이 설치되어야 Azure 발견이 가능하다. 
# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-azure>.

################################## Slow Log ##################################

# Shard level query and fetch threshold logging.
# Shard 레벨 쿼리와 페치 스레쉬홀드 로깅 

#index.search.slowlog.threshold.query.warn: 10s
#index.search.slowlog.threshold.query.info: 5s
#index.search.slowlog.threshold.query.debug: 2s
#index.search.slowlog.threshold.query.trace: 500ms

#index.search.slowlog.threshold.fetch.warn: 1s
#index.search.slowlog.threshold.fetch.info: 800ms
#index.search.slowlog.threshold.fetch.debug: 500ms
#index.search.slowlog.threshold.fetch.trace: 200ms

#index.indexing.slowlog.threshold.index.warn: 10s
#index.indexing.slowlog.threshold.index.info: 5s
#index.indexing.slowlog.threshold.index.debug: 2s
#index.indexing.slowlog.threshold.index.trace: 500ms

################################## GC Logging ################################

#monitor.jvm.gc.young.warn: 1000ms
#monitor.jvm.gc.young.info: 700ms
#monitor.jvm.gc.young.debug: 400ms

#monitor.jvm.gc.old.warn: 10s
#monitor.jvm.gc.old.info: 5s
#monitor.jvm.gc.old.debug: 2s

################################## Security ################################

# Uncomment if you want to enable JSONP as a valid return transport on the
# http server. With this enabled, it may pose a security risk, so disabling
# it unless you need it is recommended (it is disabled by default).
# JSONP를 원하는 경우 커멘트를 제거하여 http서버를 통해 수행할 수 있다. 
# 이것을 활성화 하면 보안 리스크가 올 수 있다. 그리고 필요하지 않은경우 disabling으로 설정하기를 추천한다. 
#http.jsonp.enable: true