'Elastic/Curator'에 해당되는 글 3건

  1. 2018.07.13 [Curator] 5.5 사용해 보기
  2. 2016.03.08 [Curator] Close 명령어 사용하기.
  3. 2016.03.03 [Curator] Curator 설치하기 on Mac

[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


: