Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

elasticsearch 6 index change to read only after few second

Tags:

I want to use elasticsearch 6 on mac os but when I create an index by adding a document to none exist index after few second index change to read-only and if add document or update document give this error

"error" : {
    "root_cause" : [
      {
        "type" : "cluster_block_exception",
        "reason" : "blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"
      }
    ],
    "type" : "cluster_block_exception",
    "reason" : "blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"
  },
  "status" : 403
}

I test to disable read only by

curl -H'Content-Type: application/json' -XPUT localhost:9200/test/_settings?pretty -d'
{
    "index": {
        "blocks.read_only": false
    }
}'
{
  "acknowledged" : true
}

but nothing change

I test elastic 6 on another system with ubuntu os it's ok and there is no error then I think maybe something wrong with my system but elasticsearch 5.6.2 works correctly without any error

the elastic log is

[2018-01-05T21:56:52,254][WARN ][o.e.c.r.a.DiskThresholdMonitor] [gCjouly] flood stage disk watermark [95%] exceeded on [gCjoulysTFy1DDU7f7dOWQ][gCjouly][/Users/peter/Downloads/elasticsearch-6.1.1/data/nodes/0] free: 15.7gb[3.3%], all indices on this node will marked read-only
like image 561
sadeghpro Avatar asked Jan 05 '18 18:01

sadeghpro


2 Answers

I had this problem I think in elastic 6 add new setting to close index when empty hard less than 5% you can disable this by below line in elasticsearch.yml

 cluster.routing.allocation.disk.threshold_enabled: false

Then restart elasticsearch. I hope this work for you

like image 131
saeed Avatar answered Oct 23 '22 01:10

saeed


Convenience for copy/pasting into Kibana console

# disable threshold alert
PUT /_cluster/settings
{
  "persistent" : {
        "cluster.routing.allocation.disk.threshold_enabled" : false
    }
}

# unlock indices from read-only state
PUT /_all/_settings
{
  "index.blocks.read_only_allow_delete": null
}
like image 44
willko747 Avatar answered Oct 23 '22 01:10

willko747