将 Elasticsearch 设置为只读模式

问题描述 投票:0回答:1

我正在尝试将我的 ElasticSearch 数据库置于只读模式,请按照此页面操作:

https://www.elastic.co/guide/en/enterprise-search/7.17/read-only-api.html

但是当我运行

curl -X GET http://localhost:9200/api/ent/v1/internal/read_only_mode -H "Content-Type: application/json" -u username:password

使用正确的用户名和密码,我得到:

{"error":"no handler found for uri [/api/ent/v1/internal/read_only_mode] and method [GET]"}

知道如何解决这个问题吗?

elasticsearch
1个回答
0
投票

您正在引用 Enterprise 搜索文档,该文档在 Elasticsearch 之上有自己的 API。

如果您想让您的 Elasticsearch 服务器只读,您只需运行以下命令即可:

curl -X PUT http://localhost:9200/_cluster/settings -H "Content-Type: application/json" -u username:password -d '{
  "persistent": {
    "cluster.blocks.read_only": true
  }
}'
© www.soinside.com 2019 - 2024. All rights reserved.