OpenSearch Quickstart

OpenSearch is an open-source search and analytics suite which serves as a centralized location to manage logs forwarded from other resources, such as databases and Droplets.


Create OpenSearch Clusters

  1. From the Create menu in the top right of the control panel, click Databases.
  2. Select OpenSearch as the database engine.
  3. Choose the cluster configuration and datacenter, and give the cluster a unique name.
    Tip
    For the best performance, create your database cluster in the same region as your other DigitalOcean resources.
  4. Click Create a Database Cluster.

Change Size or Number of Nodes

  1. Select your database cluster from the Databases page.
  2. Click the Settings tab.
  3. Click Edit in the Cluster configuration section.
  4. Select a new Droplet plan or quantity of nodes.
  5. Click Save.

Add Additional Users or Databases

You can currently only manage OpenSearch users via the API or CLI.

Add or Delete a Database User Using the CLI

How to Create a Database User Using the DigitalOcean CLI
  1. Install doctl, the DigitalOcean command-line tool.

  2. Create a personal access token and save it for use with doctl.

  3. Use the token to grant doctl access to your DigitalOcean account.

              doctl auth init
              
  4. Finally, run doctl databases user create. Basic usage looks like this, but you can read the usage docs for more details:

                doctl databases user create <database-cluster-id> <user-name> [flags]
              

    The following example creates a new user with the username example-user for a database cluster with the ID ca9f591d-f38h-5555-a0ef-1c02d1d1e35:

                  doctl databases user create ca9f591d-f38h-5555-a0ef-1c02d1d1e35 example-user
                
How to Delete a Database User Using the DigitalOcean CLI
  1. Install doctl, the DigitalOcean command-line tool.

  2. Create a personal access token and save it for use with doctl.

  3. Use the token to grant doctl access to your DigitalOcean account.

              doctl auth init
              
  4. Finally, run doctl databases user delete. Basic usage looks like this, but you can read the usage docs for more details:

                doctl databases user delete <database-cluster-id> <user-id> [flags]
              

    The following example deletes the user with the username example-user for a database cluster with the ID ca9f591d-f38h-5555-a0ef-1c02d1d1e35:

                  doctl databases user delete ca9f591d-f38h-5555-a0ef-1c02d1d1e35 example-user
                

Add or Delete a Database User Using the API

How to Create a Database User Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.

  2. Send a POST request to https://api.digitalocean.com/v2/databases/{database_cluster_uuid}/users

    cURL

    Using cURL:

                    curl -X POST \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      -d '{"name": "app-01"}' \
      "https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/users"
                  

    Go

    Using Godo, the official DigitalOcean V2 API client for Go:

                    import (
        "context"
        "os"
    
        "github.com/digitalocean/godo"
    )
    
    func main() {
        token := os.Getenv("DIGITALOCEAN_TOKEN")
    
        client := godo.NewFromToken(token)
        ctx := context.TODO()
    
        addUserRequest := &godo.DatabaseCreateUserRequest{
            Name: "app-01",
        }
    
        user, _, err := client.Databases.CreateUser(ctx, "88055188-9e54-4f21-ab11-8a918ed79ee2", addUserRequest)
    
    }
                  

    Python

                    import os
    from pydo import Client
    
    client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
    
    add_user_resp = client.databases.add_user(database_cluster_uuid="ab7bb7a", body={"name": "app-01"})
                  
How to Delete a Database User Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.

  2. Send a DELETE request to https://api.digitalocean.com/v2/databases/{database_cluster_uuid}/users/{username}

    cURL

    Using cURL:

                    curl -X DELETE \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      "https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/users/app-01"
                  

    Go

    Using Godo, the official DigitalOcean V2 API client for Go:

                    import (
        "context"
        "os"
    
        "github.com/digitalocean/godo"
    )
    
    func main() {
        token := os.Getenv("DIGITALOCEAN_TOKEN")
    
        client := godo.NewFromToken(token)
        ctx := context.TODO()
    
        _, err := client.Databases.DeleteUser(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", "app-01")
    }
                  

    Python

                    import os
    from pydo import Client
    
    client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
    
    delete_resp = client.databases.delete_user(database_cluster_uuid="aba134a", username="backend_user1")
                  

Delete Clusters

  1. Select your database cluster from the Databases page.
  2. Click the Settings tab.
  3. Click Destroy in the Destroy this database cluster section.
  4. Enter the name of the database cluster.
  5. Click Destroy.