For AI agents: The documentation index is at https://docs.digitalocean.com/llms.txt. Markdown versions of pages use the same URL with index.html.md in place of the HTML page (for example, append index.html.md to the directory path instead of opening the HTML document).
You can resize existing OpenSearch clusters at any time to add more CPUs, RAM, and storage.
Resize a Database Cluster Using the CLI
To resize a database cluster using doctl, you need to provide a value for the --size flag, which specifies the cluster’s new configuration (number of CPUs, amount of RAM, and hard disk space). Use the doctl databases options slugs command to get a list of available values.
How to Resize a Database Cluster Using the DigitalOcean CLI
- Install
doctl, the official DigitalOcean CLI.
- Create a personal access token and save it for use with
doctl.
- Use the token to grant
doctl access to your DigitalOcean account.
- Finally, run
doctl databases resize. Basic usage looks like this, but you can read the usage docs for more details:
doctl databases resize <database-cluster-id> [flags]
The following example resizes a PostgreSQL or MySQL database to have two nodes, 16 vCPUs, 64 GB of memory, and 2048 GiB of storage space:
doctl databases resize ca9f591d-9999-5555-a0ef-1c02d1d1e352 --num-nodes 2 --size db-s-16vcpu-64gb --storage-size-mib 2048000 --wait true
Resize a Database Cluster Using the API
To resize a database cluster using the API, you need to provide a value for the size field, which specifies the cluster’s configuration (number of CPUs, amount of RAM, and hard disk space). Use the /v2/databases/options endpoint to get a list of available values.
How to Resize a Database Cluster Using the DigitalOcean API
- Create a personal access token and save it for use with the API.
- Send a PUT request to
https://api.digitalocean.com/v2/databases/{database_cluster_uuid}/resize.
cURL
Using cURL:
curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-d '{"size":"db-s-4vcpu-8gb", "num_nodes":3, "storage_size_mib":163840}' \
"https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/resize"
Go
Using Godo, the official DigitalOcean API client for Go:
import (
"context"
"github.com/digitalocean/godo"
)
func main() {
pat := "mytoken"
client := godo.NewFromToken(pat)
ctx := context.TODO()
resizeRequest := &godo.DatabaseResizeRequest{
SizeSlug: "db-s-4vcpu-8gb",
NumNodes: 3,
StorageSizeMib: 163840,
}
}
Python
Using PyDo, the official DigitalOcean API client for Python:
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
req = {
"size": "db-s-4vcpu-8gb",
"num_nodes": 3,
"storage_size_mib": 163840
}
update_resp = client.databases.update_cluster_size(database_cluster_uuid="a7a8bas", body=req)
Resize a Database Cluster Using the Control Panel
To resize a OpenSearch database cluster, click the name of the cluster in the control panel to go to its Overview page, then click the Settings tab.
In the Cluster configuration section, click Edit. Select your cluster configuration and CPU option.
Then, select your storage size. You can also customize the number of nodes in the cluster to 1 or 3 nodes.
The Autoscale storage section lets you check a box to automatically increase storage when disk capacity reaches a set percentage threshold. The system bills this increase as additional storage. If you click Customize, you can type your own percentage threshold and storage increment.
When autoscaling occurs, the specified storage increment is added to each node in the cluster, not distributed across the cluster. Even when data is uneven across nodes, such as with different partition sizes, each node still receives the same increment. The total added storage is approximately the increment multiplied by the number of nodes.
Autoscaling takes several minutes, depending on the cluster size. It runs without downtime, and you do not need to take any action.
Once you have selected your new configuration and size, click Save to provision the new configuration. The provisioning takes several minutes but the total time depends on the size of the cluster.
Your cluster’s state changes from Active to Resizing until the process is done. You can expect no downtime and do not need to take action.