cockroachdb / cockroachdb/cockroach

restoreccl: clone database

Open
#98,462 1 comment 0 reactions 0 assignees View on GitHub
A-disaster-recovery C-enhancement T-disaster-recovery
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Is your feature request related to a problem? Please describe.**

We’ve found that some users wish to clone a database from one cluster to another. Often this is for proofs-of-concept or other experimentation.

Users currently do this via backup & restore. This is slow, as there are two copy steps: from source to backup on cloud storage, and from cloud storage to restore on destination. Further, this requires each cluster to configure access to the same cloud storage, which may be cumbersome.

**Describe the solution you'd like**

A command to clone (create from) a database from a source cluster to a destination cluster. Perhaps:

```sql
-- on the destination cluster
CREATE DATABASE [optional_name] FROM source_db_name ON 'source connection string'
```
This would kick off a replication job which executes to completion, has metrics, can be monitored, etc. Perhaps there would be [options similar to database restore](https://www.cockroachlabs.com/docs/stable/restore.html#options).

**Describe alternatives you've considered**

As mentioned above, users achieve this via backup & restore.

**Additional context**

Note that this is not cluster replication (C2C), which requires tenants. The above should be achievable without.

Can this strictly be a KV operation? What about system tables, users, cluster settings? The answers are probably “the same as [database restore](https://www.cockroachlabs.com/docs/stable/restore.html#databases)”.

Jira issue: CRDB-25281

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.