Replicate a directory to another cluster or to object storage¶
When you finish, a directory on a source cluster replicates continuously to a directory on a target cluster, and the target reports the relationship as ESTABLISHED.
Before you start¶
- Two Qumulo clusters, each with a REST API on port 8000 that you can reach from this machine
- An admin account on each cluster for its connection profile
- Network paths between the two clusters on TCP port 3712, the target's default replication port
- Terraform 1.11 or later
1. Copy the configuration¶
Save this as main.tf in an empty directory.
terraform {
required_version = ">= 1.11"
required_providers {
qumulo = {
source = "qumulo-terraform-registry.s3.us-east-1.amazonaws.com/qumulo/qumulo"
version = "~> 1.0"
}
}
}
provider "qumulo" {
connection_profiles = [
{
name = "source"
endpoint = "https://source.example.com:8000" # <-- Replace with the source cluster's REST API endpoint
username = "admin"
password = "YourSourcePassword123!" # <-- Replace with the source admin password
insecure_skip_verify = true
},
{
name = "target"
endpoint = "https://target.example.com:8000" # <-- Replace with the target cluster's REST API endpoint
username = "admin"
password = "YourTargetPassword123!" # <-- Replace with the target admin password
insecure_skip_verify = true
},
]
}
resource "qumulo_replication_source_relationship" "data" {
connection_profile = "source"
source_root_path = "/data" # <-- Replace with the directory to replicate
target_address = "10.1.0.1" # <-- Replace with a target address the source can reach
target_root_path = "/replica" # <-- Replace with the directory to fill on the target
trigger_initial_replication = true
}
resource "qumulo_replication_target_relationship" "data" {
connection_profile = "target"
id = qumulo_replication_source_relationship.data.id
allow_fs_path_create = true
}
output "replication_state" {
value = qumulo_replication_target_relationship.data.state
}
Replace the seven values marked <-- Replace, and leave the rest as written. Delete both insecure_skip_verify lines if both clusters' certificates are signed by a CA your machine trusts.
2. Choose when and where the data goes¶
- To pause replication during business hours, add a
blackout_windowblock and setblackout_window_timezoneon the source relationship. - To replicate the snapshots an existing snapshot policy takes, set
replication_mode = "REPLICATION_SNAPSHOT_POLICY"on the source relationship and add asnapshot_policyblock with the policy'sidand atarget_expiration. - To copy the directory to S3-compatible object storage instead, replace both relationship blocks, the output, and the
targetprofile with onequmulo_replication_object_relationshipblock set todirection = "COPY_TO_OBJECT", as in the object relationship reference. The cluster reaches the object store over HTTPS on port 443, anddirection = "COPY_FROM_OBJECT"restores from the bucket instead.
The plan in step 3 shows each change on the relationship you edited.
3. Apply¶
The plan ends with Plan: 2 to add, 0 to change, 0 to destroy. Terraform creates the source relationship first and then authorizes it on the target, since the target block reads the source relationship's ID.
The apply ends with Apply complete! Resources: 2 added, 0 changed, 0 destroyed., followed by the replication_state output.
4. Check the relationship¶
The replication_state output reads ESTABLISHED. The first replication job starts as soon as the target authorizes the relationship, because the configuration sets trigger_initial_replication = true.
Next¶
Replication concepts are in Qumulo's replication documentation, and copying to object storage is in Qumulo's Shift-To for Amazon S3 documentation. Pair replication with scheduled snapshots, look up any attribute in the qumulo_replication_source_relationship reference, and see the cluster troubleshooting guide if a step fails.