现象:
kafka积压,logstash无法将日志写入到es
logstash报错:
[logstash.outputs.elasticsearch][main][] Retrying failed action {:status=>403
:error=>{“type”=>“cluster_block_exception”, “reason”=>“index [] blocked by: [FORBIDDEN/8/index write (api)];”}}
原因:
kibana-开发工具查看索引状态:“index.blocks.write”: true,该状态会导致索引被锁,无法写入
解决
将索引设置成允许写入
方法1:登录到es服务器命令行执行:curl -uusername:password -XPUT -H “Content-Type: application/json” http://localhost:9200/_all/_settings -d ‘{“index.blocks.write”: null}’
方法2:登录到kibana-开发工具执行
PUT /_all/_settings
{
“index.blocks.write”: null
}