Block Storage Disaster Recovery
RBD Mirror is a feature of Ceph Block Storage (RBD) that enables asynchronous data replication between different Ceph clusters, providing cross-cluster Disaster Recovery (DR). Its core function is to synchronize data in a primary-backup mode, ensuring rapid service takeover by the backup cluster when the primary cluster fails.
- RBD Mirror performs incremental synchronization based on snapshots, with a default snapshot interval of once per hour (configurable). The differential data between primary and backup clusters typically corresponds to writes within one snapshot cycle.
- RBD Mirror only provides underlying storage data backup and does not handle Kubernetes resource backups. Please use the platform's Backup and Restore feature to back up PVC and PV resources.
Terminology
Backup Configuration
Prerequisites
- Prepare two clusters capable of deploying Alauda Container Platform (ACP) Storage with Ceph: a Primary cluster and a Secondary cluster, with network connectivity between them.
- Both clusters must run the same platform version (v3.12 or later).
- Create distributed storage services in both Primary and Secondary clusters.
- Create block storage pools with identical names in both Primary and Secondary clusters.
- Please ensure that the following three images have been uploaded to the platform's private image repository:
quay.io/csiaddons/k8s-controller:v0.5.0quay.io/csiaddons/k8s-sidecar:v0.8.0quay.io/brancz/kube-rbac-proxy:v0.8.0
Procedures
Enable Mirroring for Primary Cluster's Block Storage Pool
Execute the following command on the Primary cluster's Control node:
Parameters:
<block-pool-name>: Block storage pool name.
Retrieve Peer Token
This token serves as the critical credential for establishing mirror connections between clusters.
Execute the following command on the Primary cluster's Control node:
Parameters:
<block-pool-name>: Block storage pool name.
Create Peer Token Secret in Secondary Cluster
Execute the following command on the Secondary cluster's Control node:
Parameters:
<token>: Token obtained from Step 2.<block-pool-name>: Block storage pool name.
Enable Mirroring for Secondary Cluster's Block Storage Pool
在 Execute the following command on the Secondary cluster's Control node:
Parameters:
<block-pool-name>: Block storage pool name.
Deploy Mirror Daemon in Secondary Cluster
This daemon is responsible for monitoring and managing RBD mirror synchronization processes, including data synchronization and error handling.
Execute the following command on the Secondary cluster's Control node:
Verify Mirror Status
Execute the following command on the Secondary cluster's Control node:
Parameters:
<block-pool-name>: Block storage pool name.
Enable Replication Sidecar
This feature enables efficient data replication and synchronization without interrupting primary application operations, enhancing system reliability and availability.
- Deploy csiaddons-controller
Execute the following commands on both Primary and Secondary clusters' Control nodes:
Click to view
Parameters:
<registry>: Registry address of platform.
- Enable csi sidecar
Execute the following commands on both Primary and Secondary clusters' Control nodes:
Create VolumeReplicationClass
Execute the following commands on both Primary and Secondary clusters' Control nodes:
<scheduling-interval>: Scheduling interval, (e.g., schedulingInterval: "1h" indicates execution every 1 hour.)
Enable Mirror for PVC
Execute the following command on the Primary cluster's Control node:
<vr-name>: The name of the VolumeReplication object, recommended to be the same as the PVC name.<namespace>: The namespace to which the VolumeReplication belongs, which must be the same as the PVC namespace.<pvc-name>: The name of the PVC for which Mirror needs to be enabled.
Note After enabling, the RBD image in the Secondary cluster becomes read-only.
Failover
When the Primary cluster fails, it is necessary to switch the primary-backup relationship of the RBD image.
Prerequisites
- The Kubernetes resources of the Primary cluster have been backed up and restored to the Secondary cluster, including PVCs, PVs, application workloads, etc.
Procedures
创建 VolumeReplication
Execute the following command on the Secondary cluster's Control node:
<vr-name>: VolumeReplication name.<namespace>: PVC namespace.<mirror-pvc-name>: The name of the PVC.
Note After creation, the RBD image on the Secondary cluster becomes primary and is writable.