Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
153 views
in Technique[技术] by (71.8m points)

How to undo setting Elasticsearch Index to readonly?

So I just set one of my indices to readonly, and now want to delete it.

To set it to readonly:

PUT my_index/_settings
{ "index": { "index.blocks.read_only" : true } }

When I tried to delete it I got this response:

ClusterBlockException[blocked by: [FORBIDDEN/5/index read-only (api)];]

Then I tried to set the index to readonly false:

PUT my_index/_settings
{ "index": { "index.blocks.read_only" : false } }

But that gives the same error message as above. So how to set readonly back to false?

question from:https://stackoverflow.com/questions/34911181/how-to-undo-setting-elasticsearch-index-to-readonly

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Answers are really old so I'll add a elastic-6+ answer too:

PUT /[_all|<index-name>]/_settings
{
  "index.blocks.read_only_allow_delete": null
}

https://www.elastic.co/guide/en/elasticsearch/reference/6.x/disk-allocator.html

FYI (for context): I ran into read-only indices due to running out of disk and got error messages from logstash:

...retrying failed action with response code: 403 ({"type"=>"cluster_block_exception", "reason"=>"blocked"

elasticsearch:
ClusterBlockException[blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];]


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...