1. 程式人生 > 其它 >Logstash [logstash.outputs.elasticsearch][main] retrying failed action with response code: 403

Logstash [logstash.outputs.elasticsearch][main] retrying failed action with response code: 403

版權宣告:本文為CSDN博主「極客程式設計玩家」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處連結及本宣告。

原文連結:https://blog.csdn.net/lzy_zhi_yuan/article/details/117222230

問題描述
今天發現當天的索引在ES中並沒有建立,logstash中不停的報錯:

[2021-05-24T05:47:51,904][INFO ][logstash.outputs.elasticsearch] retrying failed action with response code: 403 ({"type"=>"cluster_block_exception", "reason"=>"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"})
[2021-05-24T05:47:51,904][INFO ][logstash.outputs.elasticsearch] Retrying individual bulk actions that failed or were rejected by the previous bulk request. {:count=>1}
索引變成了只讀:

原因
一旦在儲存超過95%的磁碟中的節點上分配了一個或多個分片的任何索引,該索引將被強制進入只讀模式

解決辦法
經過分析,發現是因為ES所在伺服器磁碟空間太低引起,具體解決辦法如下:

第一種辦法:在kibana開發控制檯執行下面語句:

PUT _settings
{
  "index": {
    "blocks": {
      "read_only_allow_delete": null
    }
  }
}

第二種辦法:在es節點伺服器上執行:

curl -XPUT -H 'Content-Type: application/json' --user 賬號:密碼 http://127.0.0.1:9200/_all/_settis.read_only_allow_delete": null}'