# Удаляется индекс forcemerge'м

**URL:** <https://discuss.elastic.co/t/forcemerge/142554>\
**Category:** Вопросы на русском языке\
**Created:** [August 1, 2018, 11:25am UTC](https://discuss.elastic.co/t/forcemerge/142554 "2018-08-01T11:25:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ozyab](https://avatars.discourse-cdn.com/v4/letter/o/d78d45/32.png) [@Ozyab](https://discuss.elastic.co/u/Ozyab)\
**Post date:** [August 1, 2018, 11:25am UTC](https://discuss.elastic.co/t/forcemerge/142554/1 "2018-08-01T11:25:16Z")

</div>

Всем привет.

Столкнулся с такой проблемой: поставил пару задач в куратор, и один из индексом при выполнении forcemerge началу удаляться. Не могу понять, отчего это происходит.

Задача была такая: сначала сделать forcemerge индексов старше 5 дней, а затем их allocation на холодную ноду. В curator'е создал таски:

```auto
 ---
 
 actions:
   1:
     action: forcemerge
     description: "forceMerge all logs"
     options:
       max_num_segments: 1
       delay: 1
       timeout_override:
       continue_if_exception: True
       disable_action: False
     filters:
     - filtertype: age
       source: name
       direction: older
       timestring: '%Y.%m.%d'
       unit: days
       unit_count: 5
       field:
       stats_result:
       epoch:
       exclude: False
   2:
     action: allocation
     description: "Apply shard allocation filtering rules by age"
     options:
       key: box_type
       value: cold
       wait_for_completion: True
       continue_if_exception: False
       disable_action: false
     filters:
     - filtertype: age
       source: name
       direction: older
       timestring: '%Y.%m.%d'
       unit: days
       unit_count: 10
       field:
       stats_result:
       epoch:
       exclude: False

```

В логах по задаче 1:

```auto
2018-07-28 01:00:02,979 INFO Preparing Action ID: 1, "forcemerge"
2018-07-28 01:00:02,998 INFO Trying Action ID: 1, "forcemerge": forceMerge all logs
2018-07-28 01:04:31,349 INFO forceMerging index prod-kub-2018.07.22 to 1 segments per shard. Please wait...
2018-07-28 01:04:31,349 INFO forceMerging index prod-kub-2018.07.22 to 1 segments per shard. Please wait...
....
2018-07-28 01:08:12,350 INFO Pausing for 1.0 seconds before continuing...
2018-07-28 01:08:13,352 INFO Action ID: 1, "forcemerge" completed.

```

По задаче 2:

```auto
2018-07-28 01:08:13,353 INFO Preparing Action ID: 2, "allocation"
2018-07-28 01:08:13,353 INFO Preparing Action ID: 2, "allocation"
2018-07-28 01:08:13,360 INFO Trying Action ID: 2, "allocation": Apply shard allocation filtering rules by age
2018-07-28 01:08:13,400 INFO Trying Action ID: 2, "allocation": Apply shard allocation filtering rules by age
2018-07-28 01:08:14,744 INFO Updating index setting {'index.routing.allocation.require.box_type': 'cold'}
2018-07-28 01:08:14,750 INFO Updating index setting {'index.routing.allocation.require.box_type': 'cold'}
2018-07-28 01:08:44,777 ERROR Failed to complete action: allocation. <class 'curator.exceptions.FailedExecution'>: Exception encountered. Rerun with loglevel DEBUG and/or check Elasticsearch logs for more information. Exception: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host=u'SERVER1', port=9200): Read timed out. (read timeout=30))
2018-07-28 01:08:44,782 ERROR Failed to complete action: allocation. <class 'curator.exceptions.FailedExecution'>: Exception encountered. Rerun with loglevel DEBUG and/or check Elasticsearch logs for more information. Exception: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host=u'SERVER2', port=9200): Read timed out. (read timeout=30))

```

Как итог - удаляется индексы за 5 дней, лишь один индекс, остальные все на месте. И не понятно, из-за какой задачи это происходит..

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [August 1, 2018, 6:22pm UTC](https://discuss.elastic.co/t/forcemerge/142554/2 "2018-08-01T18:22:18Z")

</div>

А можно логи с мастера посмотреть?

---

<div class="post-metadata">

**Author:** ![Ozyab](https://avatars.discourse-cdn.com/v4/letter/o/d78d45/32.png) [@Ozyab](https://discuss.elastic.co/u/Ozyab)\
**Post date:** [August 2, 2018, 6:29am UTC](https://discuss.elastic.co/t/forcemerge/142554/3 "2018-08-02T06:29:54Z")

</div>

Все оказалось намного проще. Куратор не при делах.  
В ansible скрипте обнаружился старый файл с заданием cron, где прямым текстом было прописано удалять некоторые индексы через 5 дней 🙄

Типа такого:

> for i in ${index}; do  
> logger "Clean ${i} logs"  
> for log in `curl -s 'localhost:9200/_cat/indices?v'|awk '{print $3}' |sort| grep -e ${i} |head -n -${days}`; do  
> logger "delete ${log}";  
> curl -s -XDELETE localhost:9200/${log}?pretty  
> done  
> done

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 30, 2018, 6:29am UTC](https://discuss.elastic.co/t/forcemerge/142554/4 "2018-08-30T06:29:57Z")

</div>

Closed on August 30, 2018, 6:29am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
