背景
今天線上elk的數(shù)據(jù)太多,服務(wù)器的空間不足了。所以打算刪除一些沒用用的數(shù)據(jù)。我是用下面的request:
POST /{index_name}/_delete_by_query?wait_for_completion=false
{
"query": {
"bool": {
"must": {
"match": {
"loglevel": "DEBUG"
}
}
}
}
}
但是出錯了。
{ _index: ‘’,
_type: ‘type’,
_id: ‘record id’,
status: 403,
error:
{ type: ‘cluster_block_exception’,
reason: ‘blocked by: [FORBIDDEN/8/index write (api)];’ } }
導(dǎo)致原因:
(都是比較簡單的英文,我就直接粘貼過來了):
相關(guān)帖子
from reaching red or yellow status. It does this using index.blocks.write.
The two reasons being:
Low Memory
When the JVMMemoryPressure metric exceeds 92% for 30 minutes, Amazon ES triggers a protection mechanism and blocks all write operations to prevent the cluster from reaching red status. When the protection is on, write operations fail with a ClusterBlockException error, new indexes can’t be created, and the IndexCreateBlockException error is thrown.
When the JVMMemoryPressure metric returns to 88% or lower for five minutes, the protection is disabled, and write operations to the cluster are unblocked.
Low Disk Space
Elasticsearch has a default “l(fā)ow watermark” of 85%, meaning that once disk usage exceeds 85%, Elasticsearch no longer allocates shards to that node. Elasticsearch also has a default “high watermark” of 90%, at which point it attempts to relocate shards to other nodes.
官網(wǎng)對index.blocks.write參數(shù)的描述:
https://www.elastic.co/guide/en/elasticsearch/reference/6.0/index-modules.html#dynamic-index-settings
解決方法:
https://sease.io/2022/06/elasticsearch-disk-space-issue-and-rollover-solution.html
disale index.blocks.write.文章來源:http://www.zghlxwxcb.cn/news/detail-648931.html
PUT /[_all|<your_index_name>]/_settings
{
"index.blocks.write": null
}
然后再重試之前的刪除請求。文章來源地址http://www.zghlxwxcb.cn/news/detail-648931.html
到了這里,關(guān)于【cluster_block_exception】寫操作elasticsearch索引報錯的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!