LinuxCommandLibrary

doctl-databases-pool

Manage DigitalOcean database connection pools

TLDR

Run a doctl databases pool command with an access token

$ doctl [[d|databases]] [[p|pool]] [command] [[-t|--access-token]] [access_token]
copy

Retrieve information about a database connection pool
$ doctl [[d|databases]] [[p|pool]] [[g|get]] [database_id] [pool_name]
copy

List connection pools for a database cluster
$ doctl [[d|databases]] [[p|pool]] [[ls|list]] [database_id]
copy

Create a connection pool for a database
$ doctl [[d|databases]] [[p|pool]] [[c|create]] [database_id] [pool_name] --db [new_pool_name] --size [pool_size]
copy

Delete a connection pool for a database
$ doctl [[d|databases]] [[p|pool]] [[rm|delete]] [database_id] [pool_name]
copy

SYNOPSIS

doctl databases pool <list|create|get|update|delete> <args> [flags]

PARAMETERS

--db
    Database name to pool (default "defaultdb"; create only)

--force
    Skip confirmation prompt (delete only)

--format
    Output columns/format (e.g., normal, json; default "normal")

--no-header
    Hide table headers in output

--output
    Output format: table, json, short-table (default "table")

--region
    Datacenter region for pool (e.g., nyc1; create only)

--size
    Pool size (1-5000 connections; create/update)

--user
    Database user (default "doadmin"; create only)

DESCRIPTION

The doctl databases pool command is part of the DigitalOcean CLI (doctl), used to manage connection pools for Managed PostgreSQL Databases. Connection pools use PgBouncer to efficiently handle high volumes of short-lived connections by multiplexing them, reducing overhead and improving application performance.

This command group provides subcommands to create, list, retrieve, update, and delete connection pools associated with a database cluster. Pools are created in specific regions and can be configured with database name, user, and connection size (1-5000).

Key benefits include automatic scaling, high availability, and connection limits per pool. Authentication is required via API token, typically set with doctl auth init. Output supports formats like table or JSON for scripting.

Usage example: First list pools with doctl databases pool list <cluster-id>, then create one with doctl databases pool create <cluster-id> --region nyc1 --size 100. Pools incur additional hourly charges based on size and region.

Requires a PostgreSQL cluster; not supported for MySQL. Integrates with DigitalOcean's API for seamless infrastructure management.

CAVEATS

Limited to PostgreSQL clusters; pools billed separately (~$15+/month min); max 10 pools/cluster; size changes restart pool.

SUBCOMMANDS

list <cluster-id>: List pools.
create <cluster-id>: Create pool.
get <pool-id>: Show pool details.
update <pool-id>: Resize pool.
delete <pool-id>: Remove pool.

CONNECTION URI

After creation, use pool's URI: postgres://user:pass@pool-host:5432/db?sslmode=require

HISTORY

Introduced in doctl v1.53.0 (July 2021) with DigitalOcean Managed Database connection pools launch; enhanced in later versions for better output and regions.

SEE ALSO

doctl(1), doctl-databases(1), psql(1), pgbouncer(7)

Copied to clipboard