12

我的 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
}

有任何想法吗?

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

4

2 回答 2

14

正确的命令是:

PUT /_cluster/settings
{
  "persistent" : {
    "cluster.blocks.read_only" : false
  }
}
于 2016-08-03T06:42:11.557 回答
11

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

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

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

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

于 2018-09-24T15:40:35.667 回答