Search code examples
elasticsearchelasticsearch-2.0

Why won't a put call to the elasticsearch /_cluster/settings endpoint respect an update of settings?


I'm running Elasticsearch 2.3.3, and am looking to set up a cluster so that I can have a simulation of a production ready set up. This is set up on two Azure VMs with docker.

I'm looking at the /_cluster/settings api, to allow myself to update settings. According to the elasticserch documentation, it should be possible to update settings on clusters.

I've run on each machine the command:

docker run -d --name elastic -p 9200:9200 -p 9300:9300 elasticsearch --cluster.name=api-update-test

so now each machine sees itself as the one master and data node in a 1 machine cluster. I have then made a put request to one of these to tell it where to find the discovery.zen.ping.unicast.hosts, and to update the discovery.zen.minimum_master_nodes, with the following command (in powershell)

curl 
    -Method PUT 
    -Body '{"persistent":
        {"discovery.zen.minimum_master_nodes":2,
        "discovery.zen.ping.unicast.hosts":["<machine-one-ip>:9300"]}
    }' 
    -ContentType application/json 
    -Uri http://<machine-two-ip>:9200/_cluster/settings

The response comes back invariably with a 200 response, but a confirmation of the original settings: {"acknowledged":true,"persistent":{},"transient":{}}

Why won't elasticsearch respect this request and update these settings? It should be noted, this also happens when I use the precise content of the sample request in the documentation.


Solution

  • I always used this approach:

    curl -XPUT "http://localhost:9200/_cluster/settings" -d'
    {
      "persistent": {
        "discovery.zen.minimum_master_nodes": 2
      }
    }'
    

    And, also, only discovery.zen.minimum_master_nodes is dynamically update-able. The other one is not.