# Data Replication

Replication is a process of copying data stored on a vStor volume to another vStor, based on a schedule (recommended) or manually. Creating a replication relationship requires establishing a partnership between the two vStors first. See [vStor Partnerships](https://docs.catalogicsoftware.com/vstor-4.14/data-protection/creating-vstor-partnerships).

{% hint style="info" %} <mark style="color:blue;">**Note.**</mark> Volumes of type *filesystem*, *MinIO*, *configbackup* and *mounted file system* on the source vStor, all become *filesystem* type volumes on the target vStor during replication.
{% endhint %}

## Creating a Replication Relationship

{% hint style="warning" %} <mark style="color:orange;">**Important.**</mark> To establish an offload relationship with a secondary vStor, a partnership with this vStor must exist.
{% endhint %}

To create a replication relationship:

1. Select **Replication** from the sidebar.
2. Click the **Add new** button in the *Replication Relationships* pane to open the *Add New Relationship* dialog window.
3. Select the volume you want to replicate and the replication partner.\
   Select the **Replication Relationship Priority** for the relationship. This setting is only applicable when *Bandwidth limit* is set in System Settings (see [Replication](https://docs.catalogicsoftware.com/vstor-4.14/basic-configuration/configuring-vstor-system-settings#replication)), and it determines how much of the bandwidth is consumed by each task when they coincide.\
   You can also switch on the **Enable deletion lock on replicated snapshots** toggle for the replicated volumes on the target system. This prevents accidental or unauthorized deletion of replicated data. For details, see [Replication Deletion Protection](https://docs.catalogicsoftware.com/vstor-4.14/immutability-in-vstor#replication-deletion-protection).

<figure><img src="https://2739176026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIau5sly4ZEiucr96YGcA%2Fuploads%2Fgit-blob-b2ddfae69b303584c417ad009b243a78eafa01f4%2Frepliacation-add_new_relationship_dialog-advanced_options_collapsed.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

4. Click **Add**.

{% hint style="info" %} <mark style="color:blue;">**See also.**</mark> Replication deletion protection requires MFA to be enabled on the source vStor system. There is no MFA check on the replication target. For details, see [Using Multifactor Authentication (MFA)](https://docs.catalogicsoftware.com/vstor-4.14/advanced-configuration/using-multi-factor-authentication-in-vstor).
{% endhint %}

### Advanced Options

The *Advanced Options* section allows you to specify a custom name for the volume replica. If no name is specified, the original volume name will be used. You can also select the target pool where the volume replica will be created and stored. If no pool is specified, the first available pool will be used.

The *Attempt reconnecting to existing volume replica on partner vStor* toggle applies when a replication relationship has been established and deleted, and you want to reestablish it. If the volume replica still exists on the remote vStor, it can be reused for replication without the need to create a new one.

<figure><img src="https://2739176026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIau5sly4ZEiucr96YGcA%2Fuploads%2Fgit-blob-1837c140dadab8c29b63b426b37988936d73ee13%2Frepliacation-add_new_relationship_dialog.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %} <mark style="color:blue;">**Note.**</mark> Successful establishment of a replication relationship does not entail any data transfer from the local volume to the replica. To populate the replica with current data from the local volume, set up a schedule or synchronize data manually using the **Synchronize** button.
{% endhint %}

## Manual Synchronization

To manually synchronize data between the local volume and the replica on a partner vStor, hover over the replication relationship record or right-click the record and select **Synchronize**. The replication operation will be queued for synchronization.

<figure><img src="https://2739176026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIau5sly4ZEiucr96YGcA%2Fuploads%2FZp9jxukbF0vSDZx3JOIw%2Freplication-synchronize_button.png?alt=media&#x26;token=90a46b44-391a-4775-9963-5baec7136926" alt=""><figcaption></figcaption></figure>

## Scheduling a Replication

{% hint style="warning" %} <mark style="color:orange;">**Restrictions.**</mark> Only one schedule per replication relationship is allowed.
{% endhint %}

1. Click the **Add new** button in the *Schedules* pane. Or, right-click an offload relationship in the *Replication Relationships* pane.
2. Select an unscheduled relationship from the dropdown menu.\
   Choose the schedule type (*interval*, *weekly* or *monthly*) and select schedule details.

<figure><img src="https://2739176026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIau5sly4ZEiucr96YGcA%2Fuploads%2FEoAKNGw4HS4bB4NXqWpm%2Freplication-add_schedule_dialog.png?alt=media&#x26;token=b54bcf22-69e2-446d-9286-e71ce753bf89" alt="" width="563"><figcaption></figcaption></figure>

3. Click **Save**.

{% hint style="info" %} <mark style="color:blue;">**See also.**</mark> The time of replications depends on your vStor instance’s [NTP Settings](https://docs.catalogicsoftware.com/vstor-4.12/basic-configuration/configuring-vstor-system-settings#configuring-ntp-settings).
{% endhint %}

### Editing a Schedule

1. Right-click the schedule and select **Edit** to launch the *Edit Schedule* dialog window.
2. Make necessary changes to the schedule.
3. Click **Save**.

## Disconnecting a Replication Relationship

To disconnect a replication relationship:

1. Go to the *Replication* view and find the *Replication Relationships* pane.
2. Right-click the relationship you want to delete and click the **Delete** button. You will be prompted to confirm your choice and select some replication removal options.

## Managing Replication Relationships using vStor CLI

### Creating a Replication Relationship

To create a new replication relationship using vStor CLI, use the following command, specifying the source and partner volumes:

```
vstor relationship create --vol_id <source_volume> --partner_id <partner_address> 
```

{% hint style="info" %} <mark style="color:blue;">**Tip.**</mark> For more commands and parameters, use the `--help` flag at any level, e.g:

`vstor relationship --help`\
`vstor relationship create --help`
{% endhint %}

### Scheduling a Replication

To create a new replication relationship schedule using vStor CLI, use the following command, specifying the ID of the relationship and the type of schedule (*interval*, *weekly*, *monthly*):

```
vstor schedule create --rel_id <relationship_id> --schedule_type <type>
```

{% hint style="info" %} <mark style="color:blue;">**Tip.**</mark> For more commands and parameters, use the `--help` flag at any level, e.g:

`vstor schedule --help`\
`vstor schedule create --help`
{% endhint %}

{% hint style="info" %} <mark style="color:blue;">**See also.**</mark> For more details on best practices for backup storage, see [Data Backup: Best Practices](https://docs.catalogicsoftware.com/vstor-4.14/best-practices/data-backup).
{% endhint %}
