ES写入数据报错403
1、现象描述
业务计算数据写入Elasticsearch的时候,无法入库,报错403,查看日志具体报错信息如下:
{"index":{"_index":"202309010008","_type":"bonus","_id":"6Jq9p4sBwIccXLgNOqs_","status":403,"error":{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}}}
2、查看索引信息
进入pod执行一下命令查看索引信息:
curl http://192.168.113.30:9200/202309010008?pretty # 查看索引的详细信息
curl http://192.168.113.30:9200/202309010008/_settings?pretty # 查看索引的设置
发现索引的设置项:read_only_allow_delete: true
根据以往经验判断,磁盘数据达到90%,触发只读保护。查看磁盘空间,发现磁盘空间并无异常。
3、直接修改read_only_allow_delete
使用一下命令直接修改
curl -XPUT -H "Content-Type: application/json" http://192.168.113.30:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'