ES实例磁盘空间不足,导致索引read-only
ES实例磁盘空间不足,导致索引read-only
题现象:
数据导入失败错误日志:
retrying failed action with response code: 403 ({“type”=>”cluster_block_exception”, “reason”=>”blocked by: [FORBIDDEN/12/index read-only / allow delete (api)]
问题原因:
磁盘空间不足,磁盘使用率大于95%,索引被强制设置为只读,导致数据无写入。
解决办法:
1. 下线磁盘空间不足的ES实例。
curl -XPUT --negotiate -k -u : "https://127.0.0.1:24100/_cluster/settings" -H 'Content-Type: application/json' -d '{ "transient" : { "cluster.routing.allocation.exclude._name" : "EsNode1@192.168.198.6, EsNode2@192.168.198.6 " } }'
2. 等待数据迁移完成。执行_cluster/healht命令查询relocating_shards参数的值,直到变为0,说明迁移完毕。
curl -XGET --negotiate -k -u : "https://127.0.0.1:24100/_cluster/health?pretty"
3. 修改索引只读字段属性为null,放开写入。
curl -XPUT --negotiate -k -u : "https://127.0.0.1:24100/*/_settings" -H 'Content-Type: application/json' -d '{"index.blocks.read_only_allow_delete": null}'
4. 继续写入数据。