Elastic����������� ������������������ search����������� ������������������ 클러스터����������� ������������������ 관리cecil
Contents•일래스틱����������� ������������������ 서치����������� ������������������ 스냅샷����������� ������������������
•클러스터����������� ������������������ 상태����������� ������������������ 모니터링����������� ������������������
•클러스터����������� ������������������ 균형����������� ������������������ 잡기����������� ������������������
•샤드와����������� ������������������ 레플리카����������� ������������������ 할당����������� ������������������ 제어����������� ������������������
•색인����������� ������������������ 미리����������� ������������������ 채우기����������� ������������������
•색인����������� ������������������ 앨리어스와����������� ������������������ 일상����������� ������������������ 작업을����������� ������������������ 단순하게����������� ������������������ 만들기����������� ������������������
•일래스틱����������� ������������������ 서치����������� ������������������ 플러그인����������� ������������������ &����������� ������������������ 설정����������� ������������������ 갱신����������� ������������������ API
일래스틱����������� ������������������ 서치����������� ������������������ 스냅샵(1/2)•스냅샷은����������� ������������������ 생성한����������� ������������������ 시점의����������� ������������������ 해당����������� ������������������ 클러스터����������� ������������������ 자료를����������� ������������������ 모두����������� ������������������ 저장����������� ������������������
•API����������� ������������������ 리소스:����������� ������������������ _snapshot����������� ������������������
•저장소����������� ������������������ 생성
curl����������� ������������������ -XPUT����������� ������������������ localhost:9200/_snapshot/backup����������� ������������������ -d����������� ������������������ '{����������� ������������������ "type":����������� ������������������ "fs",����������� ������������������ "settings":����������� ������������������ {����������� ������������������ "location":����������� ������������������ "/tmp/es_backup_folder/cluster1"����������� ������������������
}����������� ������������������ }����������� ������������������ ����������� ������������������ #����������� ������������������ config에����������� ������������������ path.repo:����������� ������������������ [경로]����������� ������������������ 가����������� ������������������ 있어야����������� ������������������ 함
일래스틱����������� ������������������ 서치����������� ������������������ 스냅샵(2/2)
#����������� ������������������ 스냅샷����������� ������������������ 백업����������� ������������������ curl����������� ������������������ -XPUT����������� ������������������ ‘localhost:9200/_snapshot/backup/bckp1’����������� ������������������
#����������� ������������������ 스냅샷����������� ������������������ 복구����������� ������������������ curl����������� ������������������ -XPOST����������� ������������������ ‘localhost:9200/_snapshot/backup/bckp1/_restore’����������� ������������������
#����������� ������������������ 스냅샷����������� ������������������ 제거����������� ������������������ curl����������� ������������������ -XDELETE����������� ������������������ 'localhost:9200/_snapshot/backup/bckp1?pretty'
클러스터����������� ������������������ 상태����������� ������������������ 모니터링(1/3)
#����������� ������������������ 클러스터����������� ������������������ 상태����������� ������������������ API����������� ������������������ curl����������� ������������������ 'localhost:9200/_cluster/health?pretty'����������� ������������������
����������� ������������������ ����������� ������������������ -����������� ������������������ status:����������� ������������������ Green(정상),����������� ������������������ Yellow(모든����������� ������������������ 주����������� ������������������ 샤드����������� ������������������ 완료),����������� ������������������ red(주����������� ������������������ 샤드����������� ������������������ 완료����������� ������������������ X)����������� ������������������
#����������� ������������������ 색인����������� ������������������ 상태����������� ������������������ API����������� ������������������ curl����������� ������������������ localhost:9200/library,map/_stats?pretty����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ -����������� ������������������ docs:����������� ������������������ 색인된����������� ������������������ 문서����������� ������������������ 정보����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ -����������� ������������������ store:����������� ������������������ 저장소����������� ������������������ 정보����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ -����������� ������������������ indexing,����������� ������������������ get,����������� ������������������ search:����������� ������������������ API����������� ������������������ 처리에����������� ������������������ 따른����������� ������������������ 통계����������� ������������������ 정보
클러스터����������� ������������������ 상태����������� ������������������ 모니터링(2/3)
#����������� ������������������ 노드����������� ������������������ 정보����������� ������������������ API����������� ������������������ curl����������� ������������������ ‘localhost:9200/_nodes/<node_name>/os,jvm,plugins?pretty'
#����������� ������������������ 노드����������� ������������������ 상태����������� ������������������ API����������� ������������������ curl����������� ������������������ ‘localhost:9200/_nodes/<node_name>/stats/os,jvm,breaker?
pretty'
#����������� ������������������ 클러스터����������� ������������������ 상태����������� ������������������ API����������� ������������������ curl����������� ������������������ 'localhost:9200/_cluster/state?pretty'
클러스터����������� ������������������ 상태����������� ������������������ 모니터링(3/3)
#����������� ������������������ 중지된����������� ������������������ 작업����������� ������������������ curl����������� ������������������ ‘localhost:9200/_cluster/pending_tasks?pretty’
#����������� ������������������ 색인����������� ������������������ 세그먼트����������� ������������������ API����������� ������������������ curl����������� ������������������ ‘localhost:9200/_segments?pretty'
#����������� ������������������ cat����������� ������������������ API:����������� ������������������ json이����������� ������������������ 아닌����������� ������������������ 텍스트����������� ������������������ 형태의����������� ������������������ 뷰를����������� ������������������ 제공����������� ������������������ curl����������� ������������������ ‘localhost:9200/_cat/shards?v’
클러스터����������� ������������������ 균형����������� ������������������ 잡기•cluster.routing.allocation.allow_rebalance����������� ������������������
•균형잡기����������� ������������������ 시점을����������� ������������������ 명시:����������� ������������������ always,����������� ������������������ indices_primaryies_active,����������� ������������������ indics_all_active����������� ������������������
•cluster.routing.allocation.cluster_concurrent_rebalance����������� ������������������
•전체����������� ������������������ 클러스터를����������� ������������������ 대상으로����������� ������������������ 동시에����������� ������������������ 노드����������� ������������������ 사이에서����������� ������������������ 옮길����������� ������������������ 수����������� ������������������ 있는����������� ������������������ 샤드수를����������� ������������������ 제어,����������� ������������������ 기본값����������� ������������������ 2����������� ������������������
•cluster.routing.allocation.node_concurrent_recoveries����������� ������������������ ����������� ������������������
•단일����������� ������������������ 노드에서����������� ������������������ 동시에����������� ������������������ 초기화되는����������� ������������������ 샤드의����������� ������������������ 수를����������� ������������������ 제어,����������� ������������������ 기본값����������� ������������������ 2����������� ������������������
•cluster.routing.allocation.node_initial_primaries_recoveries����������� ������������������
•단일����������� ������������������ 노드에서����������� ������������������ 동시에����������� ������������������ 초기화����������� ������������������ 되는����������� ������������������ 주����������� ������������������ 샤드의����������� ������������������ 수를����������� ������������������ 제어����������� ������������������
•cluster.routing.allocation.enable����������� ������������������
•어떤����������� ������������������ 유형의����������� ������������������ 샤드를����������� ������������������ 할당할지����������� ������������������ 제어:����������� ������������������ all,����������� ������������������ primaries,����������� ������������������ new_primaries,����������� ������������������ none����������� ������������������
•indices.recovery.concurrent_streams����������� ������������������ ����������� ������������������
•샤드����������� ������������������ 복구하기����������� ������������������ 위해����������� ������������������ 한번에����������� ������������������ 노드에서����������� ������������������ 열릴수����������� ������������������ 있는����������� ������������������ 스트림의����������� ������������������ 수를����������� ������������������ 제어
샤드와����������� ������������������ 레플리카����������� ������������������ 할당����������� ������������������ 제어(1/4)
#����������� ������������������ 명시적����������� ������������������ 할당����������� ������������������ 제어����������� ������������������ #����������� ������������������ 노드의����������� ������������������ 설정����������� ������������������ 파일에����������� ������������������ node.zone을����������� ������������������ 명시����������� ������������������ #����������� ������������������ 색인����������� ������������������ 생성시����������� ������������������ curl����������� ������������������ -XPUT����������� ������������������ 'http://localhost:9200/shop'����������� ������������������ -d����������� ������������������ '{����������� ������������������
"settings"����������� ������������������ :����������� ������������������ {����������� ������������������ "index"����������� ������������������ :����������� ������������������ {����������� ������������������
"routing.allocation.include.zone"����������� ������������������ :����������� ������������������ "zone_one"����������� ������������������ }����������� ������������������ ����������� ������������������
}����������� ������������������ ����������� ������������������
}'
샤드와����������� ������������������ 레플리카����������� ������������������ 할당����������� ������������������ 제어(2/4)
#����������� ������������������ 할당에서����������� ������������������ 특정����������� ������������������ 노드����������� ������������������ 지정����������� ������������������ curl����������� ������������������ -XPUT����������� ������������������ 'http://localhost:9200/promotions/_settings'����������� ������������������ -d����������� ������������������ '{����������� ������������������
“index.routing.allocation.include.zone":����������� ������������������ "zone_one,zone_two"����������� ������������������ }'����������� ������������������ #����������� ������������������ 할당에서����������� ������������������ 노드����������� ������������������ 배제����������� ������������������ curl����������� ������������������ -XPUT����������� ������������������ 'localhost:9200/pictures/_settings'����������� ������������������ -d����������� ������������������ '{����������� ������������������
"index.routing.allocation.exclude.zone"����������� ������������������ :����������� ������������������ "zone_one"����������� ������������������ }'
샤드와����������� ������������������ 레플리카����������� ������������������ 할당����������� ������������������ 제어(3/4)#����������� ������������������ 할당����������� ������������������ 노드����������� ������������������ 속성����������� ������������������ 요구����������� ������������������ (node.size)����������� ������������������ curl����������� ������������������ -XPUT����������� ������������������ 'localhost:9200/pictures/_settings'����������� ������������������ -d����������� ������������������ '{����������� ������������������
"index.routing.allocation.require.size"����������� ������������������ :����������� ������������������ "big_node",����������� ������������������ "index.routing.allocation.require.zone"����������� ������������������ :����������� ������������������ "zone_one"����������� ������������������
}'����������� ������������������ ����������� ������������������
#����������� ������������������ IP����������� ������������������ 주소를����������� ������������������ 사용한����������� ������������������ 할당����������� ������������������
curl����������� ������������������ -XPUT����������� ������������������ 'localhost:9200/shop/_settings'����������� ������������������ -d����������� ������������������ '{����������� ������������������ "index.routing.allocation.include._ip"����������� ������������������ :����������� ������������������ "10.1.2.10,10.1.2.11"����������� ������������������
}'����������� ������������������ ����������� ������������������
#����������� ������������������ 클러스터����������� ������������������ 범위를����������� ������������������ 할당����������� ������������������ (전체����������� ������������������ 클러스터를����������� ������������������ 대상으로����������� ������������������ 가능한����������� ������������������ ip를����������� ������������������ 지정)����������� ������������������
#����������� ������������������ 노드당����������� ������������������ 샤드와����������� ������������������ 레플리카����������� ������������������ 수를����������� ������������������ 지정
샤드와����������� ������������������ 레플리카����������� ������������������ 할당����������� ������������������ 제어(4/4)#����������� ������������������ 샤드와����������� ������������������ 레플리카����������� ������������������ 수동으로����������� ������������������ 옮기기����������� ������������������ curl����������� ������������������ -XPOST����������� ������������������ 'localhost:9200/_cluster/reroute'����������� ������������������ -d����������� ������������������ '{����������� ������������������
"commands"����������� ������������������ :����������� ������������������ [����������� ������������������ {����������� ������������������ "move"����������� ������������������ :����������� ������������������ {����������� ������������������
"index"����������� ������������������ :����������� ������������������ "shop",����������� ������������������ "shard"����������� ������������������ :����������� ������������������ 1,����������� ������������������ "from_node"����������� ������������������ :����������� ������������������ "es_node_one",����������� ������������������ "to_node"����������� ������������������ :����������� ������������������ "es_node_two"����������� ������������������
}����������� ������������������ }]����������� ������������������ ����������� ������������������
}'����������� ������������������ ����������� ������������������
#����������� ������������������ 샤드����������� ������������������ 할당����������� ������������������ 취소:����������� ������������������ 진행중인����������� ������������������ 할당����������� ������������������ 과정을����������� ������������������ 취소����������� ������������������
#����������� ������������������ 샤드����������� ������������������ 강제����������� ������������������ 할당:����������� ������������������ 진행되지����������� ������������������ 않은����������� ������������������ 샤드를����������� ������������������ 특정����������� ������������������ 노드에����������� ������������������ 강제로����������� ������������������ 할당
색인����������� ������������������ 미리����������� ������������������ 채우기
#����������� ������������������ 미리����������� ������������������ 채우기����������� ������������������ 질의����������� ������������������ 생성,����������� ������������������ 운영����������� ������������������ 체제의����������� ������������������ IO����������� ������������������ 캐시를����������� ������������������ 미리����������� ������������������ 채움.����������� ������������������ curl����������� ������������������ -XPUT����������� ������������������ 'localhost:9200/library/_warmer/tags_warming_query'����������� ������������������ -d����������� ������������������ '{����������� ������������������
"query"����������� ������������������ :����������� ������������������ {����������� ������������������ "match_all"����������� ������������������ :����������� ������������������ {}����������� ������������������
},����������� ������������������ "facets"����������� ������������������ :����������� ������������������ {����������� ������������������
"warming_facet"����������� ������������������ :����������� ������������������ {����������� ������������������ "terms"����������� ������������������ :����������� ������������������ {����������� ������������������
"field"����������� ������������������ :����������� ������������������ "tags"����������� ������������������ }}}}����������� ������������������ #����������� ������������������ 미리����������� ������������������ 채우기����������� ������������������ 기능����������� ������������������ 활성화/비활성화����������� ������������������ curl����������� ������������������ -XPUT����������� ������������������ 'http://localhost:9200/library/_settings'����������� ������������������ -d����������� ������������������ '{����������� ������������������ ����������� ������������������ ����������� ������������������ "index.warmer.enabled"����������� ������������������ :����������� ������������������ false����������� ������������������ }'����������� ������������������
색인����������� ������������������ 앨리어스#����������� ������������������ 특정����������� ������������������ 이름으로����������� ������������������ 색인을����������� ������������������ 질의하기����������� ������������������ 위해����������� ������������������ 색인����������� ������������������ 여러개에����������� ������������������ 붙인����������� ������������������ 추가����������� ������������������ 이름����������� ������������������
#����������� ������������������ N(앨리어스):1(색인),����������� ������������������ 1(앨리어스):N(색인)����������� ������������������ 모두����������� ������������������ 가능����������� ������������������
#����������� ������������������ 1(앨리어스):N(색인)����������� ������������������ 인����������� ������������������ 경우����������� ������������������ 실시간����������� ������������������ GEt����������� ������������������ 연산이나����������� ������������������ 색인����������� ������������������ 작업에서는����������� ������������������ 사용할����������� ������������������ 수����������� ������������������ 없음����������� ������������������
#����������� ������������������ 앨리어스����������� ������������������ 생성����������� ������������������
curl����������� ������������������ -XPOST����������� ������������������ 'localhost:9200/_aliases'����������� ������������������ -d����������� ������������������ '{����������� ������������������
"actions"����������� ������������������ :����������� ������������������ [����������� ������������������
{����������� ������������������ "add"����������� ������������������ :����������� ������������������ {����������� ������������������ "index"����������� ������������������ :����������� ������������������ "day10",����������� ������������������ "alias"����������� ������������������ :����������� ������������������ "week12"����������� ������������������ }����������� ������������������ },����������� ������������������
{����������� ������������������ "add"����������� ������������������ :����������� ������������������ {����������� ������������������ "index"����������� ������������������ :����������� ������������������ "day11",����������� ������������������ "alias"����������� ������������������ :����������� ������������������ "week12"����������� ������������������ }����������� ������������������ },����������� ������������������
{����������� ������������������ "add"����������� ������������������ :����������� ������������������ {����������� ������������������ "index"����������� ������������������ :����������� ������������������ "day12",����������� ������������������ "alias"����������� ������������������ :����������� ������������������ "week12"����������� ������������������ }����������� ������������������ }����������� ������������������
]����������� ������������������ }'����������� ������������������ ����������� ������������������
#����������� ������������������ 앨리어스를����������� ������������������ 사용한����������� ������������������ 쿼리����������� ������������������
curl����������� ������������������ -XGET����������� ������������������ ‘localhost:9200/day10,day11,day12����������� ������������������ ->����������� ������������������ (week12)/_search?q=test’
일래스틱서치����������� ������������������ 플러그인&설정����������� ������������������ 갱신����������� ������������������ API#����������� ������������������ 플러그인����������� ������������������ 설치����������� ������������������
bin/plugin����������� ������������������ -install����������� ������������������ elasticsearch/elasticsearch-lang-javascript/
2.0.0.RC1����������� ������������������
#����������� ������������������ 플러그인����������� ������������������ 제거����������� ������������������
bin/plugin����������� ������������������ -remove����������� ������������������ river-mongodb����������� ������������������
#����������� ������������������ 설정����������� ������������������ 갱신����������� ������������������ API����������� ������������������
curl����������� ������������������ -XPUT����������� ������������������ 'localhost:9200/_cluster/settings'����������� ������������������ -d����������� ������������������ '{����������� ������������������
"transient"����������� ������������������ :����������� ������������������ {����������� ������������������
"PROPERTY_NAME"����������� ������������������ :����������� ������������������ "PROPERTY_VALUE"����������� ������������������
}����������� ������������������
}'����������� ������������������
Q&A
References• Rafat����������� ������������������ Kuc.,����������� ������������������ Marek����������� ������������������ Rogozinski.,����������� ������������������ 전문����������� ������������������ 검색과����������� ������������������ 분석을����������� ������������������ 위한����������� ������������������
Elasticsearch����������� ������������������ 서버(박재호����������� ������������������ 옮김).����������� ������������������ 경기도����������� ������������������ 의왕시:����������� ������������������ 에이콘출판(주),����������� ������������������ 2014����������� ������������������
• 김종민,����������� ������������������ 시작하세요!����������� ������������������ 엘라스틱서치.����������� ������������������ 경기도����������� ������������������ 파주시:����������� ������������������ 위키북스,����������� ������������������ 2015