---
title: "External Replication Task"
description: "Set up external database replication in RavenDB Studio with connection string configuration, filtering, and delay options."
url: "https://docs.ravendb.net/7.2/studio/database/tasks/ongoing-tasks/external-replication-task"
version: "7.2"
---

# External Replication Task

> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

## External Replication Task

> **Note**
>
> - Schedule an **External Replication Task** in order to have a *live* replica of your data in another database:
>   - In the same cluster if you want a live copy that won't be a client failover target.
>   - In a separate RavenDB cluster [on local machines](https://docs.ravendb.net/7.2/start/getting-started.md) or [a cloud instance](https://docs.ravendb.net/cloud/cloud-overview.md),  
>     which can be used as a failover if the source cluster is down.
>
> - "Live" means that the replica is up to date at all times.  
>   Any changes in the source database will be reflected in the replica once they occur.
>
> - This ongoing task replicates **one-way**, from the source to the destination. For additional functionality,  
>   such as filtration and two-way (master-master) replication, consider [Hub/Sink Replication](https://docs.ravendb.net/7.2/studio/database/tasks/ongoing-tasks/hub-sink-replication/overview.md).
>
> - To replicate between two separate, secure RavenDB servers,  
>   you need to [pass a client certificate](#step-by-step-guide) from the source server to the destination.
>
> - External replication can be a comfortable means of data migration into a [sharded](https://docs.ravendb.net/7.2/sharding/overview.md) database.  
>   You can read more about this option in the sharding documentation [external replication](https://docs.ravendb.net/7.2/sharding/external-replication.md) and [migration](https://docs.ravendb.net/7.2/sharding/migration.md) sections.
>
> - The External Replication task **does *not* create a backup** of your data and indexes.  
>   See more in [Backup -vs- Replication](https://docs.ravendb.net/7.2/backup/faq.md#is-an-external-replication-task-a-good-substitute-for-a-backup-task)
>
> - In this page:
>   - [General Information about External Replication Task](#general-information-about-external-replication-task)
>   - [Step-by-Step Guide](#step-by-step-guide)
>   - [Definition](#definition)
>   - [Details in Tasks List View](#details-in-tasks-list-view)
>   - [Offline Behavior](#offline-behavior)

## General Information about External Replication Task

What is being replicated:  
All database documents and related data.

- [Attachments](https://docs.ravendb.net/7.2/document-extensions/attachments/overview.md)
- [Revisions](https://docs.ravendb.net/7.2/document-extensions/revisions/overview.md)
- [Counters](https://docs.ravendb.net/7.2/document-extensions/counters/overview.md)
- [Time Series](https://docs.ravendb.net/7.2/document-extensions/timeseries/overview.md)

What is **not** being replicated:  
Server and cluster level features.

- [Indexes](https://docs.ravendb.net/7.2/indexes/creating-and-deploying.md)
- [Conflict resolver definitions](https://docs.ravendb.net/7.2/server/clustering/replication/replication-conflicts.md#conflict-resolution-script)
- [Compare-Exchange](https://docs.ravendb.net/7.2/compare-exchange/overview.md)
- [Subscriptions](https://docs.ravendb.net/7.2/data-subscriptions/overview.md)
- [Identities](https://docs.ravendb.net/7.2/server/kb/document-identifier-generation.md#strategy--3)
- Ongoing tasks
  - [ETL](https://docs.ravendb.net/7.2/server/ongoing-tasks/etl/basics.md)
  - [Backup](https://docs.ravendb.net/7.2/backup/create/periodic-tasks/database-backup.md#creating-and-managing-periodic-backups-via-studio)
  - [Hub/Sink Replication](https://docs.ravendb.net/7.2/studio/database/tasks/ongoing-tasks/hub-sink-replication/overview.md)

> **Note:** Why are cluster-level features not replicated? {#why-are-cluster-level-features-not-replicated}
>
> RavenDB is designed with a cluster-level data ownership model to prevent conflicts between clusters,  
> especially in scenarios where ACID transactions are critical.
>
> This approach ensures that certain features, such as policies, configurations, and ongoing tasks,  
> remain specific to each cluster, avoiding potential inconsistencies.
>
> To explore this concept further, refer to the [Data Ownership in a Distributed System](https://ayende.com/blog/196769-B/data-ownership-in-a-distributed-system) blog post.

Conflicts:

- Two databases that have an External Replication task defined between them will detect and resolve document
  [conflicts](https://docs.ravendb.net/7.2/server/clustering/replication/replication-conflicts.md) according to each database conflict resolution policy.
- It is recommended to have the same [conflict resolution policy configuration](https://docs.ravendb.net/7.2/server/clustering/replication/replication-conflicts.md#configuring-conflict-resolution-using-the-client) on both the source and the target databases.

## Step-by-Step Guide

1. **Pass Certificate from Source Server to Destination Server**  
   This step must be done if replicating *to a separate secure cluster* so that the destination cluster trusts the source.

- **Via RavenDB Studio:**  
  Navigate from the "Manage Server" tab (left side) > "Certificates" to open the [Certificate Management](https://docs.ravendb.net/7.2/server/security/authentication/certificate-management.md) view.
  - Learn how to [pass certificates here](https://docs.ravendb.net/7.2/server/security/authentication/certificate-management.md#enabling-communication-between-servers:-importing-and-exporting-certificates).
- **Via API:**  
  See the code sample to learn how to [define a client certificate in the DocumentStore()](https://docs.ravendb.net/7.2/client-api/creating-document-store.md).
  - To generate and configure a client certificate from the source server:  
    **Via code**, see [CreateClientCertificateOperation](https://docs.ravendb.net/7.2/client-api/operations/server-wide/certificates/create-client-certificate.md).  
    **Via RavenDB CLI** PowerShell command, see [Client Certificate Usage](https://docs.ravendb.net/7.2/server/security/authentication/client-certificate-usage.md)
  - Learn the rationale needed to configure client certificates in [The RavenDB Security Authorization Approach](https://docs.ravendb.net/7.2/server/security/authentication/certificate-management.md#the-ravendb-security-authorization-approach)

2. **Create Target Database in Destination Server**

- Consider [creating an empty target database](https://docs.ravendb.net/7.2/studio/database/create-new-database/general-flow.md)
  because data transfer can overwrite existing data.
- If the source database is [encrypted](https://docs.ravendb.net/7.2/studio/database/create-new-database/encrypted.md#creating-encrypted-database),
  be sure that the target database is as well.  
  ![Encrypted Logo](https://docs.ravendb.net/assets/images/encrypted-logo-a3238d744d9a3a853b42efe10ded4efb.png)

3. **Define External Replication Task in the Source Database**  
   Learn more about [defining the task](#definition) in the dedicated section.

- **Optional Parameters**
  - Task Name
  - Delay Time
  - Preferred Node
- **Required Parameters**
  - Connection String
- **Save**
  - Click "Save" to activate the External Replication task.
  - Check the target database to see if data has been transferred. This can take at least about 20-30 seconds, depending on the dataset size.
  - If the data did not transfer properly, check the notifications (top-right of Studio)
    in the responsible node to see if there were any errors.

## Definition

To access the External Replication Task Studio interface:

a. Open the **Databases** view in the source server.  
b. Select the **source** database.  
c. Click **Tasks** tab.  
d. Select **Ongoing Tasks**  
e. Click **Add a database task**  
f. Click **External Replication** to access the following interface.

![Figure 1. External Replication Task Definition](https://docs.ravendb.net/assets/images/external-replication-1-8c0abf67380b937515203714e77a2a0f.png)

1. **Source Database**  
   Be sure that you are defining the task from the correct source database.

2. **Task Name** (Optional)
   - Choose a name of your choice
   - If no name is given then the RavenDB server will create one for you based on the defined connection string

3. **Set Replication Delay Time** (Optional)
   - If a delay time is set then data will be replicated only after this time period has passed for each data change.
   - Having a delayed instance of a database allows you to "go back in time" and undo contamination to your data due to an attack, faulty patch script, or other human errors.
     - This doesn't replace the need to [safely backup your databases](https://docs.ravendb.net/7.2/backup/create/periodic-tasks/database-backup.md#creating-and-managing-periodic-backups-via-studio), but it does provide a way to stay online while repairing.

4. **Set Preferred Responsible Node** (Optional)

- Select a preferred mentor node from the [Database Group](https://docs.ravendb.net/7.2/studio/database/settings/manage-database-group.md) to be the responsible node for this External Replication Task
- If not selected, then the cluster will assign a responsible node (see [Members Duties](https://docs.ravendb.net/7.2/studio/database/settings/manage-database-group.md#database-group-topology---members-duties))

5. **Create a new RavenDB connection string**

- Select a connection string from the pre-defined list -or- create a new connection string to be used.
- The connection string defines the external database and its server URL to replicate to.  
  ![External Replication: Connection String](https://docs.ravendb.net/assets/images/external-replication-connection-string-e67bf8fcf8761f7522207650acaf96a5.png)

  1. **Name**  
     Give the connection string a meaningful name.
  2. **Database**  
     Copy the exact name of the destination database.
     - If the source database is encrypted, make sure that the destination is encrypted as well.
  3. **Discovery URL**  
     Copy the URL from the destination server here.
     ![External Replication: URL](https://docs.ravendb.net/assets/images/external-replication-url-11665834708d6ac9ec13b366f97ee787.png)
     - Be sure to copy only the server URL - without extraneous details.
  4. **Save**  
     Click "Save" to activate the External Replication task.

  > **Note:** If the destination database is in a cluster {#if-the-destination-database-is-in-a-cluster}
  >
  > You can set multiple connection strings to multiple different nodes on different machines
  > so that if one is down, the other can keep the destination updated.  
  > See [Offline Behavior - When the destination node is down](#offline-behavior).  
  > If you define only one node's connection string, RavenDB will wait until that node is online and will then update any missing information.

## Details in Tasks List View

![Figure 2. External Replication Task - Task List View](https://docs.ravendb.net/assets/images/external-replication-2-a3969476c4a360705c1647dccb677b54.png)

1. **External Replication Task Details**:
   - **Task Status** - Active / Not Active / Not on Node / Reconnect
   - **Connection String** - The connection string used
   - **Destination Database** - The external database to which the data is being replicated
   - **Actual Destination URL** - The server URL to which the data is actually being replicated,  
     the one that is currently used out of the available *Topology Discovery URLs*
   - **Topology Discovery URLs** - List of the available destination Database Group servers URLs

2. **Database Group Topology**:  
   Visual representation showing the responsible node for the External Replication Task

## Offline Behavior

- **When the source cluster is down** (and there is no leader):

  - Creating a *new* Ongoing Task is a Cluster-Wide operation,  
    thus, a new Ongoing External Replication Task ***cannot*** be scheduled.

  - If an External Replication Task was *already* defined and active when the cluster went down,  
    then the task will *not* be active, no replication will take place.

- **When the node responsible for the external replication task is down**

  - If the responsible node for the External Replication Task is down,  
    then another node from the Database Group will take ownership of the task so that the external replica is up to date.

- **When the destination node is down:**

  - The external replication will wait until the destination is reachable again and proceed from where it left off.

  - If there is a cluster on the other side, and the URL addresses of the destination database group nodes are listed in the connection string,
    then when the destination node is down, the replication task will simply start transferring data to one of the other nodes specified.
