DBAtlas · 数据库运维图谱

查找、取消或限流长时间运行的搜索和 reindex 任务

Elasticsearch维护

命令

# Longest running tasks:
GET _cat/tasks?v&detailed&h=action,task_id,parent_task_id,running_time,node,description&s=running_time:desc
# Search, reindex and by-query tasks, grouped by parent:
GET _tasks?actions=*search*,*reindex*,*byquery*&detailed=true&group_by=parents
# Cancel a single task:
POST _tasks/<task_id>/_cancel
# Cancel all search tasks (with care):
POST _tasks/_cancel?actions=*search*
# Slow down a running reindex/update_by_query:
POST _reindex/<task_id>/_rethrottle?requests_per_second=500

作用

按持续时间对集群中运行的任务排序,显示搜索和批量操作及其查询描述;取消选定的任务或所有搜索,并对 reindex/by-query 作业限流。

适用场景

search 线程池占满、CPU 突然上升、某个仪表板以繁重的聚合拖累集群,或 update_by_query 影响生产时。

注意

取消是协作式的:任务在下一个检查点停止;某些阶段(如 force merge)无法取消。取消所有搜索会给用户返回错误。被取消的 reindex/by-query 不会回滚已做的更改;目标中会包含部分数据。父任务被取消时,其子任务也会被取消。

在 DBAtlas 中打开 →

相关内容