PiVirt disaster recovery workflows ensure business continuity through multi-site replication, automated failover triggers, and cross-datacenter cluster state restoration.
flowchart TB
subgraph Primary["Primary Site"]
P_PVC["PiVirt Cluster"]
P_ETCD["etcd Cluster"]
P_STOR[("Shared Storage<br/>(iSCSI / OCFS2)")]
end
subgraph DR["DR Site"]
D_PVC["PiVirt Cluster<br/>(Standby)"]
D_ETCD["etcd Cluster<br/>(Standby)"]
D_STOR[("Shared Storage<br/>(Replica)")]
end
Primary -->|"Replication<br/>(async / semi-sync)"| DR
Strategy
RPO
Use Case
Synchronous replication
0
Zero data loss required
Semi-synchronous
< 1 min
Minimal data loss acceptable
Asynchronous
< 1 hour
Some data loss acceptable
Daily backup
< 24 hours
Non-critical data
Strategy
RTO
Use Case
Hot standby
< 1 min
Critical services
Warm standby
< 15 min
Important services
Cold standby
< 1 hour
Non-critical services
Backup restore
< 4 hours
Archival data
pvcli cluster backup create --name backup-2024-01-15
# Automated backup (cron)
0 2 * * * pvcli cluster backup create --name " backup-$( date + \% Y- \% m- \% d ) " --retention 7d
pvcli cluster backup create --name backup-2024-01-15 \
--destination s3://backups.pilab.hu/etcd/
pvcli vm snapshot create web-01 --name " backup-before-update "
pvcli vm backup create web-01 \
--destination s3://backups.pilab.hu/vms/ \
--name " web-01-backup-2024-01-15 "
pvcli storage snapshot create --volume data-01 --name " data-01-backup "
pvcli storage volume backup create data-01 \
--destination s3://backups.pilab.hu/volumes/ \
--name " data-01-backup-2024-01-15 "
target_iqn : " iqn.2024-01.hu.pilab:replica "
target_portal : " 10.0.2.10:3260 "
bandwidth_limit_mbps : 0 # No limit
target_iqn : " iqn.2024-01.hu.pilab:replica "
target_portal : " 10.0.2.10:3260 "
bandwidth_limit_mbps : 1000
target_iqn : " iqn.2024-01.hu.pilab:replica "
target_portal : " 10.0.2.10:3260 "
bandwidth_limit_mbps : 1000
pvcli storage replication pause --volume data-01
# 2. Verify replication status
pvcli storage replication status
pvcli storage replication promote --volume data-01 --site dr-site
# 4. Update DNS/load balancer
pvcli cluster get dr-cluster
# 1. Check primary site status
# (If unreachable, proceed)
# 2. Force promote DR site
pvcli storage replication promote --volume data-01 --site dr-site --force
# 3. Update DNS/load balancer
pvcli cluster get dr-cluster
pvcli cluster backup list
pvcli cluster backup restore --name backup-2024-01-15
# Restore to specific point
pvcli cluster backup restore --name backup-2024-01-15 --force
pvcli vm snapshot restore web-01 --name " backup-before-update "
pvcli vm backup restore \
--source s3://backups.pilab.hu/vms/web-01-backup-2024-01-15 \
pvcli storage snapshot restore --volume data-01 --name " data-01-backup "
pvcli storage volume backup restore \
--source s3://backups.pilab.hu/volumes/data-01-backup-2024-01-15 \
# Test failover (non-disruptive)
pvcli dr test-failover --cluster prod-cluster --dry-run
# Test restore (non-disruptive)
pvcli dr test-restore --backup backup-2024-01-15 --dry-run
# View replication metrics
curl http://localhost:9003/metrics | grep replication
# iscsiman_replication_lag_seconds{volume="data-01"} 5
# iscsiman_replication_bytes_total{volume="data-01"} 1073741824
# iscsiman_replication_status{volume="data-01",status="healthy"} 1
- alert : PivirtReplicationLagHigh
expr : iscsiman_replication_lag_seconds > 60
summary : " Replication lag > 60s for {{ $labels.volume }} "
- alert : PivirtReplicationFailed
expr : iscsiman_replication_status{status="failed"} == 1
summary : " Replication failed for {{ $labels.volume }} "
- alert : PivirtBackupFailed
expr : pivirt_backup_status{status="failed"} == 1
summary : " Backup failed for {{ $labels.resource }} "
0 2 * * * pvcli cluster backup create --name " backup-$( date + \% Y- \% m- \% d ) "
0 3 * * 0 pvcli vm backup create --all --destination s3://backups.pilab.hu/vms/
# Hourly storage snapshots
0 * * * * pvcli storage snapshot create --all-volumes --name " hourly-$( date + \% H ) "
0 0 1 * * pvcli dr test-failover --cluster prod-cluster
Document failover procedures
Document recovery procedures
Keep runbooks up to date
Train team members
Set up alerts for replication lag
Monitor backup success rate
Track RPO/RTO metrics
# Check replication status
pvcli storage replication status
# Check network connectivity
journalctl -u iscsiman -f | grep -i replicat
pvcli cluster backup get backup-2024-01-15 -o yaml
pvcli cluster backup logs backup-2024-01-15
pvcli cluster backup verify --name backup-2024-01-15
pvcli cluster backup restore --name backup-2024-01-15 --verbose