doctl Verified current stable Not installed? Cloud Infrastructure

Doctl / Delete Database Replica

Delete Database Replica

Delete an existing database replica from a specified database.

$
Terminal
doctl d r rm <database_id> <replica_name>

When To Use

When cleaning up unnecessary replicas post-traffic analysis or performance adjustment.

Pro Tip

Consider backing up the replica before deletion to avoid data loss and downtime implications.

Warning

Destructive operation. Confirm the target path and keep a backup before executing.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
$ doctl databases replica rm 123456 my-replica

Deleting database replica 'my-replica'...

Success! Database replica 'my-replica' has been deleted.

Anatomy of Output

Understanding the result

Deleting replica: replica_name from database: database_id Deletion Status

Outlines the specifics before actual deletion.

Replica deleted successfully Output

Confirms the deletion of the specified replica.

Power User Variants

Optimized versions

doctl databases replica delete database_id replica_name --force

Force delete without confirmation prompt.

Unix Pipeline

Shell combinations

doctl databases replica delete --help

Access help for deletion command specifics.

Troubleshooting

Common pitfalls

Error: Replica not found

Solution: Confirm that the replica name is correct and it exists.

Error: Database ID mismatch

Solution: Ensure that the replica is associated with the specified database.

Error: Unauthorized

Solution: Validate your access token and permissions.

Command Breakdown

What each part is doing

doctl
Base Command
The executable that performs this operation. Here it runs Doctl before the shell applies any redirect operators.
d
d|databases
The value supplied for d|databases.
r
r|replica
The value supplied for r|replica.
rm
rm|delete
The value supplied for rm|delete.
<database_id>
database id
The value supplied for database id.
<replica_name>
replica name
The value supplied for replica name.

How To Run

Execution path

  1. Step 1

    Identify the database ID and replica name to delete.

  2. Step 2

    Run the command: doctl databases replica rm <database_id> <replica_name>.

  3. Step 3

    Confirm deletion in the terminal output.

Alternative Approaches

Comparable commands in other tools

Alternative cloud infrastructure tools for the same job.