The cluster.persistent_tasks.allocation.enable
setting in Elasticsearch controls whether the cluster is allowed to assign persistent tasks to nodes. Persistent tasks are long-running operations that need to be maintained across cluster restarts, such as data frame analytics jobs or machine learning jobs.
Description
- Default value:
all
- Possible values:
all
,none
- Recommendation: Keep the default value unless you need to temporarily prevent new persistent tasks from being assigned.
This setting determines whether Elasticsearch can allocate persistent tasks to nodes in the cluster. When set to all
(default), the cluster can freely assign persistent tasks. When set to none
, no new persistent tasks will be assigned, although existing tasks will continue to run.
Example
To disable persistent task allocation using the cluster settings API:
PUT _cluster/settings
{
"persistent": {
"cluster.persistent_tasks.allocation.enable": "none"
}
}
You might want to change this setting when performing cluster maintenance or when you need to prevent new resource-intensive tasks from starting temporarily.
Common Issues and Misuses
- Forgetting to re-enable persistent task allocation after maintenance, which can prevent new machine learning jobs or data frame analytics from starting.
- Using this setting to manage resources instead of proper capacity planning.
Do's and Don'ts
- Do use this setting temporarily during maintenance windows.
- Do remember to reset the setting to
all
after maintenance is complete. - Don't leave this setting as
none
for extended periods in a production environment. - Don't use this as a long-term solution for resource management issues.
Frequently Asked Questions
Q: How does changing this setting affect running persistent tasks?
A: Changing this setting to none
does not stop or remove already running persistent tasks. It only prevents new tasks from being allocated.
Q: Can I use this setting to stop all machine learning jobs at once?
A: No, this setting prevents new allocations but doesn't stop running jobs. Use the Machine Learning APIs to stop running jobs.
Q: Will setting this to none
free up resources immediately?
A: No, existing tasks will continue to run. This setting only prevents new task allocations.
Q: How quickly does the change take effect?
A: The change is immediate for new task allocations, but it doesn't affect already running tasks.
Q: Can this setting be used to balance persistent tasks across nodes?
A: No, this setting is not for load balancing. It's a binary switch for allowing or disallowing new task allocations cluster-wide.