curl 通过API从Opensearch集群中删除设置

gmxoilav  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(147)

我有一个Opensearch集群,使用官方指南(https://opensearch.org/docs/latest/security/access-control/cross-cluster-search/)设置了跨集群搜索。现在我需要禁用它。我无法访问节点或底层VM,只能访问curl和API。
现在我的集群设置看起来像这样:

# Setting up cross-cluster search
curl -k -XPUT -H 'Content-Type: application/json' -u 'admin:admin' 'https://my-cluster-hostname:9200/_cluster/settings' -d '
{
  "persistent": {
    "cluster.remote": {
      "cross-cluster-name": {
        "seeds": ["cross-cluster-node-01:9300", "cross-cluster-node-02:9300", "cross-cluster-node-03:9300", "cross-cluster-node-04:9300" ]
      }
    }
  }
}'

# Get cluster settings
curl -XGET -k -u 'admin:admin' 'https://my-cluster-hostname:9200/_cluster/settings?pretty'

# output:
{
  "persistent" : {
    "cluster" : {
      "remote" : {
        "cross-cluster-name" : {
          "seeds" : [
            "cross-cluster-node-01:9300",
            "cross-cluster-node-02:9300",
            "cross-cluster-node-03:9300",
            "cross-cluster-node-04:9300"
          ]
        }
      }
    }
  },
  "transient" : { }
}

字符串
如何删除这些设置以禁用跨群集搜索?
我所尝试的:

# tried to delete settings alltogether
curl -XDELETE -k -u 'admin:admin' 'https://my-cluster-hostname:9200/_cluster/settings'
# output:
{"error":"Incorrect HTTP method for uri [/_cluster/settings] and method [DELETE], allowed: [PUT, GET]","status":405}%  

# tried to replace with empty setting 
curl -k -XPUT -H 'Content-Type: application/json' -u 'admin:admin' 'https://my-cluster-hostname:9200/_cluster/settings' -d '
{ "persistent": { "cluster" : { "remote" : {} } }, "transient" : { } }'
# output:
{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: no settings to update;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: no settings to update;"},"status":400}%


更新:感谢Martin P.回答我能够找到正确的解决方案.要从设置中删除远程集群,它的种子必须设置为空:

curl -k -XPUT -H 'Content-Type: application/json' -u 'admin:admin' 'https://my-cluster-hostname:9200/_cluster/settings' -d '
{
  "persistent": {
    "cluster.remote": {
      "cross-cluster-name": {
        "seeds": null
      }
    }
  }
}'


在这里找到了答案:https://discuss.elastic.co/t/cross-cluster-search-questions/222379/7,在这里有更多关于模块的文档:https://www.elastic.co/guide/en/elasticsearch/reference/5.6/modules-cross-cluster-search.html

jyztefdp

jyztefdp1#

尝试设置一个空值。这是删除以前完成设置的方法。

curl -k -XPUT -H 'Content-Type: application/json' -u 'admin:admin' 'https://my-cluster-hostname:9200/_cluster/settings' -d '{ "persistent": { "cluster.remote": null  }}'

字符串

相关问题