doctl-databases-replica
Manage DigitalOcean database replica instances
TLDR
Run a doctl databases replica command with an access token
Retrieve information about a read-only database replica
Retrieve list of read-only database replicas
Create a read-only database replica
Delete a read-only database replica
SYNOPSIS
doctl databases replica <command> [arguments...] [flags...]
Common commands:
doctl databases replica create <cluster-id> --name <replica-name> [flags...]
doctl databases replica list <cluster-id> [flags...]
doctl databases replica get <cluster-id> <replica-name> [flags...]
doctl databases replica delete <cluster-id> <replica-name> [flags...]
PARAMETERS
command
The specific operation to perform on replicas. Common commands include create, list, get, and delete.
cluster-id
The unique identifier of the primary database cluster to which the replica belongs. Required for most subcommands.
replica-name
The desired name for the new replica (for create), or the name of an existing replica to operate on (for get, delete).
--name string
Required for the create command. Specifies the name of the new read replica.
--region string
Optional for the create command. Specifies the datacenter region where the read replica will be deployed (e.g., nyc3). If omitted, it defaults to the primary cluster's region.
--size string
Optional for the create command. Specifies the slug of the node size for the replica (e.g., db-s-1vcpu-1gb). If omitted, it defaults to the primary cluster's size.
--format string
Comma-separated list of columns to display in the output (e.g., ID,Name,Status). Applicable to list and get.
--no-header
Boolean flag to suppress table headers in the output. Applicable to list and get.
--json
Boolean flag to output results in JSON format. Applicable to all commands.
--force
Boolean flag to skip confirmation prompts, particularly useful for destructive operations like delete.
DESCRIPTION
doctl databases replica is a command group within the DigitalOcean CLI (doctl) that provides tools to manage read replicas for your DigitalOcean Managed Databases. Read replicas are asynchronous, read-only copies of your primary database cluster. They are primarily used to scale read-heavy applications, offload analytical queries from the primary database, and improve performance by distributing read traffic across multiple instances. This command group allows users to create, list, retrieve details for, and delete these replicas directly from the command line, integrating seamlessly with DigitalOcean's database service. Key subcommands include create for provisioning new replicas, list to view existing ones, get for detailed information, and delete to remove them.
CAVEATS
Read-Only Nature: Read replicas are strictly read-only; no write operations can be performed directly on them.
Asynchronous Replication: Data replication from the primary to the replica is asynchronous, meaning there might be a slight delay (replication lag) between the primary and the replica.
Deletion is Permanent: Deleting a read replica is a permanent action and cannot be undone.
Billing: Read replicas are billed as separate database nodes based on their size and region, adding to your DigitalOcean costs.
Supported Databases: Read replicas are primarily supported for PostgreSQL and MySQL managed databases. Other database types like Redis may not have the same concept of read replicas.
TYPICAL USAGE WORKFLOW
A common workflow involves first creating a primary database cluster using doctl databases create. Once the primary is active, you can then create one or more read replicas using doctl databases replica create to distribute read traffic. You can monitor their status with doctl databases replica list and retrieve detailed information with doctl databases replica get, and delete them when no longer needed with doctl databases replica delete.
CROSS-REGION REPLICAS
DigitalOcean supports creating read replicas in a different region than the primary database cluster for enhanced disaster recovery and lower latency for geo-distributed applications. This can be specified using the --region flag during replica creation, provided the chosen regions support this feature for the specific database engine.
HISTORY
DigitalOcean introduced Managed Databases as a service to simplify database management for developers. The capability to create read replicas was added to address the growing need for horizontal scaling of read-heavy applications and to offload analytical workloads. The doctl CLI, being the primary programmatic interface for DigitalOcean resources, integrated these database management capabilities, including replica management, as part of its ongoing development to provide comprehensive infrastructure control via the command line.
SEE ALSO
doctl(1), doctl databases(1), doctl databases create(1), doctl databases list(1)