Updating a deployment: Resize and add high availabilityedit

In an earlier example, we created a simple deployment called My First Deployment that included only a small Elasticsearch cluster with a single node in a single availability zone. This Elasticsearch cluster in our deployment is small with only 2048 MB of RAM. Any serious indexing activity will likely require more capacity, so let’s change memory_per_node to 4096. To make the cluster in our deployment highly available, let’s also change the value of zone_count to 3, which will create Elasticsearch nodes across three availability zones.

Before you beginedit

This example requires a deployment with an Elasticsearch cluster to work with that is not being used for anything important. If you don’t already have one, you can follow our My First Deployment example to create one.

To make the cluster highly available, your Elastic Cloud Enterprise installation must include more than one availability zone, which is something you control with the --availability-zone parameter when you install Elastic Cloud Enterprise on additional hosts. If you don’t have additional availability zones to work with, you can perform just a resize operation.

To resize a resource from a deployment and add high availability we will do a PUT request to an existing deployment. We will use the same body we used to create the deployment, with the following differences:

  • The name of the deployment can be modified or it will stay the same if not specified.
  • prune_orphans is an important parameter. It specified how resources not included in the body of this PUT request should be handled:

    • if true, those resources not included will be shut down
    • if false, those resources not included will be kept intact

For example, in a deployment with both an Elasticsearch and a Kibana resource, we can update only the Elasticsearch resource by including only this resource in the body and setting prune_orphans as false.

curl -k -X PUT -H "Authorization: ApiKey $ECE_API_KEY" https://$COORDINATOR_HOST:12443/api/v1/deployments/$DEPLOYMENT_ID -H 'content-type: application/json' -d '{
    "prune_orphans": false,
    "resources":{
       "elasticsearch": [{
          "region": "ece-region",
          "ref_id": "main-elasticsearch",
          "plan":{
              "cluster_topology": [{
                  "node_type": {
                      "master": true,
                      "data": true,
                      "ingest": true
                  },
                  "zone_count": 3,
                  "size": {
                      "resource": "memory",
                      "value": 4096
                  }
              }],
              "elasticsearch":{
                  "version": "6.8.6"
              },
              "deployment_template":{
                  "id": "default"
              }
          }
      }]
   }
}'

We could also add new resources as part of this PUT request and those would be included in the deployment. The response will always contain the list of all resources in the deployment (not only the updated ones).

After the plan is applied successfully, the Elasticsearch cluster in your deployment has 4096MB of memory and is highly available. You can verify the new settings either in the ECE UI or by performing another GET request on the /api/v1/deployments/$DEPLOYMENT_ID/elasticsearch/$REF_ID endpoint.