【问题标题】:ElasticSearch entered "read only" mode, node cannot be alteredElasticSearch 进入“只读”模式,节点无法更改
【发布时间】:2016-12-08 16:45:29
【问题描述】:

我的 ES 集群(由 5 个数据节点、3 个主节点组成)在夜间发生了一些事情。

我不知道发生了什么,但所有索引和数据都被删除了,集群进入了“只读”模式,可能被黑了?

当尝试让 Kibana 运行时,我得到以下信息:

尝试重新启动 Kibana - 它重新启动,没有任何改变。 尝试重新启动 Elastic - 它重新启动(所有节点),没有任何改变。

然后我查看了集群设置,这就是我得到的:

{
  "persistent": {
    "cluster": {
      "routing": {
        "allocation": {
          "enable": "all"
        }
      },
      "blocks": {
        "read_only": "true"
      }
    }
  },
  "transient": {
    "cluster": {
      "routing": {
        "allocation": {
          "enable": "all"
        }
      }
    }
  }
}

我尝试按如下方式撤消只读:

PUT _cluster/settings
{
  "persistent": {
    "blocks.read_only": false
  }
}

如你所见,运气不佳:

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

有什么想法吗?

更新:Problem solved by Andrei Stefan,现在是更重要的部分 - 为什么? 发生了什么,为什么? 我丢失了所有数据,并且我的集群进入了只读模式。

【问题讨论】:

  • 您能否检查一下您的elasticsearch.yml 文件中是否有blocks.read_only: true 设置?
  • @Val 检查,它在任何节点中都不存在..

标签: elasticsearch kibana kibana-4 elasticsearch-indices


【解决方案1】:

正确的命令是:

PUT /_cluster/settings
{
  "persistent" : {
    "cluster.blocks.read_only" : false
  }
}

【讨论】:

  • curl -u elastic:changeme -XPUT 'localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{"persistent":{"cluster.blocks.read_only":false}}' 不幸的是对我不起作用:(虽然它确实改变了只读属性:{"acknowledged":true,"persistent":{"cluster":{"blocks":{"read_only":"false"}}},"transient":{}}
【解决方案2】:

事实证明 ES 对可用磁盘空间有一些阈值,当“洪水”被击中时,它会将 indeces 置于只读模式。

为了将其重新设置(使用 ES6 测试),您需要执行以下操作:

PUT /[index_name]/_settings
{
  "index.blocks.read_only_allow_delete": null
}

更多信息可以在文档的以下页面找到: https://www.elastic.co/guide/en/elasticsearch/reference/current/disk-allocator.html

【讨论】:

  • 这正是我们案例中发生的事情!谢谢分享
  • 感谢,一次重置所有索引可以发出类似:curl -X PUT "localhost:9200/*/_settings" -H 'Content-Type: application/json' -d'{"index.blocks.read_only_allow_delete": null}'
猜你喜欢
  • 2019-07-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-15
  • 1970-01-01
相关资源
最近更新 更多