防止在Elasticsearch中意外删除索引

防止在Elasticsearch中意外删除索引

💡 原文英文,约200词,阅读约需1分钟。
📝

内容提要

在Elasticsearch中,使用通配符删除索引可能导致意外删除不必要的索引。通过将action.destructive_requires_name设置为true,可以强制指定索引名称进行删除,从而避免此类问题。

🎯

关键要点

  • 在Elasticsearch中,使用通配符删除索引可能导致意外删除不必要的索引。
  • 设置action.destructive_requires_name为true,可以强制指定索引名称进行删除。
  • 当该选项为true时,无法使用通配符删除索引。
  • 可以通过API调用检查当前设置:GET /_cluster/settings?include_defaults=true。
  • 要将action.destructive_requires_name设置为true,可以使用PUT /_cluster/settings { "persistent": { "action.destructive_requires_name": true } }。

延伸问答

在Elasticsearch中,使用通配符删除索引有什么风险?

使用通配符删除索引可能导致意外删除不必要的索引,从而对业务造成严重干扰。

如何防止在Elasticsearch中意外删除索引?

可以通过将action.destructive_requires_name设置为true,强制指定索引名称进行删除,从而避免意外删除。

如何检查Elasticsearch中action.destructive_requires_name的当前设置?

可以通过API调用GET /_cluster/settings?include_defaults=true来检查当前设置。

如何将action.destructive_requires_name设置为true?

可以使用PUT /_cluster/settings { "persistent": { "action.destructive_requires_name": true } }来设置该选项为true。

当action.destructive_requires_name为true时,能否使用通配符删除索引?

当该选项为true时,无法使用通配符删除索引。

action.destructive_requires_name的默认值是什么?

action.destructive_requires_name的默认值为true。

➡️

继续阅读