doctl-databases-pool
Manage DigitalOcean database connection pools
TLDR
Run a doctl databases pool command with an access token
Retrieve information about a database connection pool
List connection pools for a database cluster
Create a connection pool for a database
Delete a connection pool for a database
SYNOPSIS
doctl databases pool command database-cluster-id [database-name] [pool-name] [flags]
Specific command usages:
- doctl databases pool list database-cluster-id database-name [flags]
- doctl databases pool create database-cluster-id database-name pool-name --mode session|transaction|statement --size connections [flags]
- doctl databases pool get database-cluster-id database-name pool-name [flags]
- doctl databases pool delete database-cluster-id database-name pool-name [flags]
PARAMETERS
database-cluster-id
The unique identifier (UUID) of the DigitalOcean database cluster.
database-name
The name of the specific database within the cluster to which the pool belongs or for which it is created/managed.
pool-name
The unique name given to the connection pool for identification within the specified database.
--mode session|transaction|statement
(For create command) Specifies the transaction mode for the connection pool. Defines how the pool manages connections during transactions. Options are session (default), transaction, or statement.
--size int
(For create command) Sets the maximum number of connections allowed in the pool. This determines how many simultaneous connections can be active in the pool.
-f, --force
(For delete command) Forces the deletion of the pool without a confirmation prompt.
-o, --output json|csv|text
Specifies the output format for the command's results. Default is 'text'.
--access-token string
DigitalOcean API access token. Overrides the DO_API_TOKEN environment variable or configured token.
--config string
Path to the doctl configuration file. Defaults to $HOME/.config/doctl/config.yaml.
DESCRIPTION
doctl is the official command-line interface for the DigitalOcean API, enabling users to interact with and manage their cloud resources directly from the terminal. The doctl databases pool command specifically focuses on the administration of connection pools for DigitalOcean Managed Databases.
Database connection pools are a vital feature for optimizing database performance and resource utilization in applications, especially those with high concurrency. They allow applications to reuse existing database connections rather than establishing a new one for every request, significantly reducing overhead, improving response times, and conserving database resources.
This command provides subcommands to perform essential operations on database pools, including:
- Creating new pools with specified sizes and transaction modes.
- Listing all existing pools for a database to monitor their configurations.
- Retrieving detailed information about a specific pool.
- Deleting pools when they are no longer required.
CAVEATS
- The choice of connection pool mode (session, transaction, statement) has significant implications for application behavior and concurrency; it must align with the application's database transaction model.
- Setting the --size parameter requires careful consideration of the database's capacity and the application's expected concurrency. An excessively large pool can overload the database, while too small a pool can lead to bottlenecks.
- Deleting a connection pool will immediately terminate all active connections associated with it, potentially disrupting applications that are currently using the pool.
- DigitalOcean Managed Databases have underlying resource limits. Creating a large number of pools or pools with very high connection limits might impact overall cluster performance or run into service quotas.
AUTHENTICATION
doctl commands, including doctl databases pool, require authentication via a DigitalOcean API token. This token can be provided through the DO_API_TOKEN environment variable, specified with the --access-token flag, or configured in the doctl configuration file (typically at ~/.config/doctl/config.yaml).
ERROR HANDLING
Upon failure, doctl commands typically return a non-zero exit code. Detailed error messages are usually displayed on the console, providing guidance for troubleshooting API issues, invalid parameters, or resource limitations.
SCRIPTING AND AUTOMATION
For scripting and automation purposes, using the -o json flag is highly recommended. This outputs command results in a structured JSON format, making it easy to parse and process programmatically in various scripting languages.
HISTORY
The doctl command-line tool, developed by DigitalOcean, provides a comprehensive programmatic interface to their cloud platform. Its evolution has paralleled the expansion of DigitalOcean's product ecosystem, including the introduction of Managed Databases. Managed Databases, designed to simplify database administration, offload complex setup and maintenance tasks to DigitalOcean. The doctl databases pool subcommand was added as part of these efforts, enabling customers to manage this critical performance-enhancing feature directly from their command line. This integration facilitates automation, scripting, and seamless inclusion within CI/CD pipelines, reflecting a broader industry shift towards infrastructure-as-code and API-driven resource management.