> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate to CockroachDB

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

MOLT Fetch supports various migration flows using <InternalLink path="molt-fetch#define-fetch-mode">MOLT Fetch modes</InternalLink>.

For CockroachDB-to-CockroachDB migrations, contact your account team for guidance.

| Migration flow     | Mode                         | Description                                                                                 | Best for                                                                                                                                   |
| ------------------ | ---------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Bulk load          | `--mode data-load`           | Perform a one-time bulk load of source data into CockroachDB.                               | Testing, migrations with <InternalLink version="molt" path="migration-considerations#permissible-downtime">planned downtime</InternalLink> |
| Load and replicate | MOLT Fetch + MOLT Replicator | Load source data using MOLT Fetch, then replicate subsequent changes using MOLT Replicator. | <InternalLink version="molt" path="migration-considerations#permissible-downtime">Minimal downtime</InternalLink> migrations               |
| Resume replication | `--mode replication-only`    | Resume replication from a checkpoint after interruption.                                    | Resuming interrupted migrations, post-load sync                                                                                            |
| Failback           | `--mode failback`            | Replicate changes from CockroachDB back to the source database.                             | Rollback scenarios                                                                                                                         |

### Bulk load

For migrations that tolerate downtime, use `data-load` mode to perform a one-time bulk load of source data into CockroachDB.

### Migrations with minimal downtime

To minimize downtime during migration, MOLT Fetch supports replication streams that sync ongoing changes from the source database to CockroachDB. Instead of performing the entire data load during a planned downtime window, you can perform an initial load followed by continuous replication. Writes are only briefly paused to allow replication to drain before final cutover. The length of the pause depends on the volume of write traffic and the amount of replication lag between the source and CockroachDB.

* Use MOLT Fetch for data loading followed by MOLT Replicator for replication.

### Recovery and rollback strategies

If the migration is interrupted or you need to abort cutover, MOLT Fetch supports safe recovery flows:

* Use `replication-only` to resume a previously interrupted replication stream.
* Use `failback` to reverse the migration, syncing changes from CockroachDB back to the original source. This ensures data consistency on the source so that you can retry later.

## See also

* <InternalLink path="migration-strategy">Migration Strategy</InternalLink>
* <InternalLink version="releases" path="molt">MOLT Releases</InternalLink>
