'Curator'에 해당되는 글 4건

  1. 2018.07.13 [Curator] 5.5 사용해 보기
  2. 2016.03.08 [Curator] Close 명령어 사용하기.
  3. 2016.03.03 [Curator] Curator 설치하기 on Mac
  4. 2014.01.22 [elasticsearch] curator, snapshot & restore 소개.

[Curator] 5.5 사용해 보기

Elastic/Curator 2018. 7. 13. 19:34

오랜만에 사용해 보려고 했더니 또 기억이나질 않아서 기록해 봅니다.


공식문서)

https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/index.html


설치)

https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/pip.html


설치 방법이 예전이랑 좀 달라진게 있더군요.

저는 아래 방법으로 설치 했습니다.


$ pip install --user elasticsearch-curator


실행)

https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/command-line.html

https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/singleton-cli.html


$ curator [--config CONFIG.YML] [--dry-run] ACTION_FILE.YML 


이 방식으로 이전 3.x 버전에서는 command 를 주고 사용했었으나 4.2 버전 이후 부터는 Singleton command line interface 를 사용해야 합니다. 


- prefix 방식

$ curator_cli --host localhost --port 9200 show_indices --filter_list '{"filtertype":"pattern", "kind":"prefix", "value":"search-"}'


- regex 방식

$ curator_cli --host localhost --port 9200 show_indices --filter_list '{"filtertype":"pattern", "kind":"regex", "value":"^(search-).*$"}'


예제)

https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/examples.html


더 많은 예제는 위 문서에서 찾아 보시면서 해보시면 될 것 같습니다.


:

[Curator] Close 명령어 사용하기.

Elastic/Curator 2016. 3. 8. 11:49

curator를 이용해서 elasticsearch의 index를 관리 할 수 있다는 것은 잘 알려진 내용입니다.

오래된 index를 close 하기 위해 curator를 이용해 보겠습니다.


참고 문서)


원문 예제)


일반적으로 아래와 같은 패턴으로 많이 사용을 하게 됩니다.


$ curator --host localhost --port 9200 close indices --time-unit days --older-than 7 --timestring %Y.%m.%d


이 명령어의 의미는 time series 패턴을 이용해서 7일이 지난 index들을 모두 close 하라는 의미 입니다.

이와 같은 패턴을 사용하기 위해서는 당연히 index name rule이 아래와 같아야 합니다.


# INDEXNAME-YYYY.MM.DD

# logstash-2016.03.08


하지만 꼭 이런 패턴으로 index를 생성하지 않을 수도 있기 때문에 다른 방법도 필요해 보입니다.

그럼 어떻게 할 수 있을까요?

아래 flags를 잘 참고하셔서 사용하면 됩니다.


참고 문서)


여기서 prefix 를 이용해서 close 하는 예를 살펴 보겠습니다.


indices name) 아래와 같이 YYYYMMDDHHMI 로 되어 있다고 가정 합니다.

logstash-201603081100

logstash-201603081105

logstash-201603081110

logstash-201603081115

logstash-201603081120

logstash-201603081125


명령어)

$ curator --host localhost --port 9200 close indices --prefix logstash-20160308110


이와 같이 실행을 하면 11시 00분 부터 11시 09분까지의 인덱스는 모두 close 됩니다.

이외 다른 옵션들도 많으니 잘 참고해서 활용하시길 바랍니다.


:

[Curator] Curator 설치하기 on Mac

Elastic/Curator 2016. 3. 3. 11:20

elasticsearch의 index를 관리하기 위한 매우 유용한 도구 입니다.

저 같은 경우 맥북을 개발장비로 사용하기 때문에 맥에 설치 하는 방법을 기록해 봅니다.

기본적으로는 elastic에서 제공하는 문서를 보고 설치 하시면 됩니다.


참고문서)


Step 1) get-pip.py 다운로드


Step 2) get-pip.py 설치

$ sudo python get-pip.py

Collecting pip

  Downloading pip-8.0.3-py2.py3-none-any.whl (1.2MB)

    100% |████████████████████████████████| 1.2MB 372kB/s

Collecting wheel

  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)

    100% |████████████████████████████████| 69kB 5.4MB/s

Installing collected packages: pip, wheel

Successfully installed pip-8.0.3 wheel-0.29.0


Step 3) curator 설치

$ sudo pip install elasticsearch-curator==3.4.1


Collecting elasticsearch-curator==3.4.1

  Downloading elasticsearch_curator-3.4.1-py2.py3-none-any.whl (44kB)

    100% |████████████████████████████████| 45kB 201kB/s

Collecting click>=3.3 (from elasticsearch-curator==3.4.1)

  Downloading click-6.3-py2.py3-none-any.whl (70kB)

    100% |████████████████████████████████| 73kB 141kB/s

Collecting elasticsearch<2.4.0,>=1.8.0 (from elasticsearch-curator==3.4.1)

  Downloading elasticsearch-2.3.0-py2.py3-none-any.whl (51kB)

    100% |████████████████████████████████| 53kB 163kB/s

Collecting urllib3<2.0,>=1.8 (from elasticsearch<2.4.0,>=1.8.0->elasticsearch-curator==3.4.1)

  Downloading urllib3-1.14-py2.py3-none-any.whl (89kB)

    100% |████████████████████████████████| 90kB 232kB/s

Installing collected packages: click, urllib3, elasticsearch, elasticsearch-curator

Successfully installed click-6.3 elasticsearch-2.3.0 elasticsearch-curator-3.4.1 urllib3-1.14


※ Version

Python 2.7.10


:

[elasticsearch] curator, snapshot & restore 소개.

Elastic/Elasticsearch 2014. 1. 22. 10:42

그냥 elasticsearch.org 블로그 들어가 보시면 있는 내용입니다.

관심 있는 분들은 벌써 아실 내용이긴 한데 그냥 소개해 봅니다.



이건 원래도 있던 기능이긴 했는데 그닥 유용하다고 생각 하지 않았습니다.

이번에 나온건 실제 유용하게 사용할 수 있겠더라구요.

일단 지원 하는 repository 를 보면.


Currently, we support file system, S3, Azure and HDFS repositories.


백업 및 복구용으로 활용하세요.




간단하게 소개 하면 index 에 대한 disk 용량 관리를 해주는 도구라고 보시면 됩니다.

아마도 logstash 를 사용하시는 분들에게 필요한 도구 일 것 같구요.

cron 에 등록해 놓고 사용 하시면 됩니다.


[옵션]

$ curator.py -h
usage
: curator.py [-h] [-v] [--host HOST] [--port PORT] [-t TIMEOUT]
                 
[-p PREFIX] [-s SEPARATOR] [-C CURATION_STYLE]
                 
[-T TIME_UNIT] [-d DELETE_OLDER] [-c CLOSE_OLDER]
                 
[-b BLOOM_OLDER] [-g DISK_SPACE]
                 
[--max_num_segments MAX_NUM_SEGMENTS] [-o OPTIMIZE] [-n]
                 
[-D] [-l LOG_FILE]

Curator for Elasticsearch indices. Can delete (by space or time), close,
disable bloom filters and optimize
(forceMerge) your indices.

optional arguments
:
 
-h, --help            show this help message and exit
 
-v, --version         show program version number and exit
 
--host HOST           Elasticsearch host. Default: localhost
 
--port PORT           Elasticsearch port. Default: 9200
 
-t TIMEOUT, --timeout TIMEOUT
                       
Elasticsearch timeout. Default: 30
 
-p PREFIX, --prefix PREFIX
                       
Prefix for the indices. Indices that do not have this
                        prefix are skipped
. Default: logstash-
 
-s SEPARATOR, --separator SEPARATOR
                       
Time unit separator. Default: .
 
-C CURATION_STYLE, --curation-style CURATION_STYLE
                       
Curate indices by [time, space] Default: time
 
-T TIME_UNIT, --time-unit TIME_UNIT
                       
Unit of time to reckon by: [days, hours] Default: days
 
-d DELETE_OLDER, --delete DELETE_OLDER
                       
Delete indices older than n TIME_UNITs.
 
-c CLOSE_OLDER, --close CLOSE_OLDER
                       
Close indices older than n TIME_UNITs.
 
-b BLOOM_OLDER, --bloom BLOOM_OLDER
                       
Disable bloom filter for indices older than n
                        TIME_UNITs
.
 
-g DISK_SPACE, --disk-space DISK_SPACE
                       
Delete indices beyond n GIGABYTES.
 
--max_num_segments MAX_NUM_SEGMENTS
                       
Maximum number of segments, post-optimize. Default: 2
 
-o OPTIMIZE, --optimize OPTIMIZE
                       
Optimize (Lucene forceMerge) indices older than n
                        TIME_UNITs
. Must increase timeout to stay connected
                        throughout optimize operation
, recommend no less than
                       
3600.
 
-n, --dry-run         If true, does not perform any changes to the
                       
Elasticsearch indices.
 
-D, --debug           Debug mode
 
-l LOG_FILE, --logfile LOG_FILE
                        log file


: