hoatranlab.io.vn Zalo: 0917516878 Hotline: 0917516878 [email protected]
HoaTranLab HoaTranLab
Buổi 10 / 14

Backup & Disaster Recovery

Chiến lược bảo vệ dữ liệu toàn diện: Veeam, 3-2-1 Rule, VMware SRM, VCSA File-Based Backup.

~4 giờ Intermediate Veeam SRM
Nội dung thực hành trên ESXi 8.0 Update 3 & vCenter Server 8.0 Update 3 (Build 24022515)

Mục tiêu buổi học

  • Nắm vững nguyên tắc 3-2-1 Backup Rule và RPO/RTO concepts
  • Hiểu kiến trúc Veeam Backup & Replication cho môi trường vSphere
  • Cấu hình VCSA File-Based Backup qua VAMI
  • Hiểu tổng quan VMware Site Recovery Manager (SRM) cho DR
  • Xây dựng Deployment Checklist hoàn chỉnh trước khi go-live

Lý Thuyết

Nguyên tắc 3-2-1 Backup Rule

3-2-1 Rule (Industry Standard):

  3 copies of data
  ├── 1 production copy (primary)
  ├── 1 backup copy (local — NAS/SAN)
  └── 1 offsite copy (remote site / cloud)

  2 different storage media
  ├── e.g., VMFS (primary) + NFS NAS (backup)
  └── e.g., SAN (primary) + Object Storage S3 (offsite)

  1 copy offsite (geographic separation)
  └── Remote datacenter / Cloud (AWS S3, Azure Blob)

Extended: 3-2-1-1-0
  + 1 immutable/air-gapped copy (ransomware protection)
  + 0 errors on recovery verification (automated testing)

RPO & RTO Definitions

Timeline:
  Last Backup         Failure          Recovery Complete
      │                  │                    │
  ────┼──────────────────┼────────────────────┼────
      │◄─── RPO ────────►│◄───── RTO ────────►│

RPO (Recovery Point Objective):
  Lượng dữ liệu tối đa có thể mất được
  RPO = 1h → backup mỗi giờ, chấp nhận mất ≤1h data
  RPO = 0  → synchronous replication (FT, synchronous SRM)

RTO (Recovery Time Objective):
  Thời gian tối đa để khôi phục dịch vụ
  RTO = 4h → trong 4h phải restore xong và dịch vụ UP
  RTO = 0  → FT, Active-Active (zero downtime)

Veeam Backup & Replication v12.x — Kiến trúc

Veeam B&R v12.x (current) hỗ trợ đầy đủ vSphere 8.0 Update 3.

Veeam Architecture:

  ┌──────────────────────────────────────────────────┐
  │           Veeam Backup Server (VBR)              │
  │  (Windows Server — quản lý toàn bộ Veeam)        │
  └──────────┬───────────────────────────────────────┘
             │ vSphere API (VADP)
             ▼
  ┌──────────────────────┐    ┌──────────────────────┐
  │   Veeam Proxy        │    │   Backup Repository  │
  │ (Data Mover)         │───►│ (NFS/CIFS/S3/Tape)   │
  │ - Virtual Appliance  │    │ - Scale-Out Repo      │
  │ - Network Mode       │    │ - Immutable S3        │
  └──────────────────────┘    └──────────────────────┘
             │
             ▼
  ESXi Hosts (VADP snapshots → read VM data)

Veeam Backup Modes (ưu tiên theo thứ tự)

ModeCơ chếUse CaseTốc độ
Direct SAN AccessĐọc data từ SAN trực tiếp, bypass ESXi và networkFC/iSCSI SAN environmentNhanh nhất
HotAdd (Virtual Appliance)Proxy VM attach VMDK tạm thời qua VMware API — yêu cầu vCenter credentials + ESXi direct accessvSphere environment (khuyến nghị)Nhanh
Network (NBD)Đọc qua VMkernel networkFallback, mọi environmentChậm hơn

Changed Block Tracking (CBT): Được bật per-VM để cho phép incremental backup — chỉ sao lưu các block đã thay đổi kể từ lần backup trước, giảm đáng kể backup window và dung lượng.

VCSA File-Based Backup

VCSA Backup via VAMI (port 5480):

  Backup includes:
  ├── Configuration (bắt buộc)
  ├── Inventory (recommended)
  └── Events & Tasks (optional — tốn space)

  Supported destinations:
  ├── FTP / FTPS
  ├── HTTP / HTTPS
  ├── SCP (SSH)
  ├── NFS
  └── SMB (CIFS)

  Restore procedure:
  Mount VCSA ISO → Installer → Restore
  Nhập backup location → Stage 1: Deploy → Stage 2: Restore data

VMware Site Recovery Manager (SRM)

SRM Architecture:

  Protected Site (Primary)          Recovery Site (DR)
  ┌──────────────────────┐          ┌──────────────────────┐
  │  vCenter HN          │          │  vCenter HCM         │
  │  SRM Plugin          │◄────────►│  SRM Plugin          │
  │  vSphere Replication │─replicate│  vSphere Replication │
  │  Production VMs      │─────────►│  Replica VMs         │
  └──────────────────────┘          └──────────────────────┘

Recovery Plans (Runbook tự động):
  Step 1: Shutdown VMs tại Protected Site (nếu planned)
  Step 2: Promote replica VMs → Power On tại Recovery Site
  Step 3: IP customization (re-IP nếu khác subnet)
  Step 4: DNS updates
  Step 5: Test connectivity
  Step 6: Mark recovery complete

RPO: phụ thuộc replication interval (min 5 phút với vSphere Replication)
RTO: 15-30 phút (automated failover)

Failback: Sau khi Primary site khôi phục
  → Replicate ngược từ DR về Primary
  → Planned migration back

Lab Thực Hành

Lab 10.1 — VCSA File-Based Backup (VAMI)

Truy cập VAMI: https://vcsa-01.lab.local:5480
Admin / password

Backup → Configure

Backup Location:
  Protocol: SCP
  Server: 10.100.100.50
  Port: 22
  User: backup-svc
  Password: ****
  Directory: /backups/vcsa

Schedule:
  ✓ Enable scheduled backup
  Frequency: Daily
  Time: 02:00 AM
  Retention: 7 (giữ 7 bản)

Data to backup:
  ✓ Configuration (required)
  ✓ Inventory (recommended)
  □ Events and Tasks (optional, tốn space)

→ Save → Run Backup Now (test ngay)

Verify:
  SSH vào backup server:
  ls -lh /backups/vcsa/
  # Thấy: sn-vcsa-01_20260418_020000_...

Lab 10.2 — Cấu hình Veeam Backup Job cho VMs

Veeam Backup & Replication Console:

1. Add vCenter Infrastructure:
   Inventory → Add Server
   Type: VMware vSphere
   Address: vcsa-01.lab.local
   Credentials: [email protected]

2. Tạo Backup Job — Production VMs:
   Jobs → Backup → New Backup Job
   Name: BKP-Production-Daily

   Virtual Machines:
   + Add → Container → Resource Pool: RP-Production
     (tự động include VMs mới thêm vào RP)

   Storage:
   Backup Repository: Repo-NAS-Primary (NFS)
   Retention: 14 restore points (2 tuần)

   Guest Processing:
   ✓ Enable application-aware processing
   ✓ Enable guest file system indexing
   Credentials: Administrator / *****

   Schedule:
   Daily at 11:00 PM
   ✓ Retry: 3 times, every 10 minutes

3. Tạo Backup Copy Job (offsite):
   Jobs → Backup Copy → New Backup Copy Job
   Name: BKP-COPY-Offsite
   Source: BKP-Production-Daily
   Target Repository: Repo-S3-Offsite (immutable)
   Retention: 30 days
   GFS: Weekly 4, Monthly 3, Yearly 1

Lab 10.3 — Test Restore từ Veeam

Restore options trong Veeam:

1. Instant VM Recovery (nhanh nhất):
   Home → Restore → VMware vSphere
   → Instant Recovery to VMware vSphere
   VM: web-server-01
   Restore Point: Latest
   Target Host: esxi-02.lab.local
   Target Datastore: DS-iSCSI-VMFS6-01
   → Power on VM immediately
   (VM chạy trực tiếp từ backup repo — RTO <2 phút)

2. Full VM Restore:
   → Entire VM Restore
   VM: web-server-01
   → Restore to original location (overwrite)
   HOẶC → Restore to new location (recovery test)

3. File-Level Recovery (restore 1 file):
   → Guest Files Recovery → Microsoft Windows
   → Browse backup → Navigate folders
   → Restore / Copy to

4. Application Item Recovery (Exchange/SQL/AD):
   → Application Items → Microsoft SQL Server
   → Select database → Restore to original

Lab 10.4 — Pre & Post-Deployment Checklist

=== PRE-DEPLOYMENT CHECKLIST ===

Hardware:
  □ CPU hỗ trợ VT-x/AMD-V, VT-d
  □ Kiểm tra VMware HCL
  □ BIOS firmware phiên bản mới nhất
  □ RAID controller: write-back cache, BBU
  □ NIC: tối thiểu 4 ports 10 Gbps

Network:
  □ Physical switch hỗ trợ 802.1Q VLAN trunking
  □ LACP/802.3ad configured nếu dùng
  □ Jumbo Frames (MTU 9000) cho Storage/vMotion
  □ STP PortFast / BPDU Guard cho ESXi uplinks
  □ VLANs: Management, vMotion, Storage, VM trunks

DNS/NTP:
  □ Forward/reverse DNS cho tất cả ESXi và VCSA
  □ NTP synchronized (chrony/ntpd)

Storage:
  □ Storage array trên VMware HCL
  □ Multipathing policy: RR (Round Robin) Active-Active
  □ VAAI hỗ trợ
  □ Capacity đủ theo sizing formula

=== POST-DEPLOYMENT CHECKLIST ===

vCenter:
  □ VCSA backup configured (file-based + scheduled)
  □ AD integration và RBAC setup
  □ Alarms cấu hình (CPU, Memory, Storage, Network)
  □ Syslog forwarding đến SIEM

ESXi Hosts:
  □ SSH disabled
  □ Lockdown Mode: Normal (hoặc Strict)
  □ Core Dumps cấu hình
  □ Host Profiles applied và compliant

Cluster:
  □ vSphere HA enabled + tested
  □ DRS Fully Automated
  □ EVC Mode set
  □ Resource Pools phản ánh SLAs

Backup:
  □ Veeam Job chạy thành công
  □ Test restore VM đã xác nhận
  □ Offsite copy configured
  □ Monitoring alerts cho backup failures

ỨNG DỤNG DOANH NGHIỆP — MODULE 10

Triển khai Veeam B&R trong môi trường doanh nghiệp thực tế — từ thiết kế kiến trúc proxy/repository đến SLA policy, DR automation và SureBackup compliance.

1. Veeam B&R Architecture — Proxy, Repository & Transport Mode

Thiết kế đúng kiến trúc Veeam từ đầu giúp đạt RPO target và tránh bottleneck backup window.

### TOPOLOGY — Veeam B&R Enterprise Architecture

  ┌─────────────────────────────────────────────────────────────────┐
  │                    VEEAM BACKUP & REPLICATION SERVER             │
  │   veeam-mgr.hoatranlab.io.local  (8 vCPU, 32 GB RAM)              │
  │   ┌──────────────────────┐  ┌──────────────────────────────┐   │
  │   │  BACKUP PROXY × 2    │  │  BACKUP REPOSITORY           │   │
  │   │  proxy-01 (VMware)   │  │  repo-01: NFS 40TB (primary) │   │
  │   │  proxy-02 (VMware)   │  │  repo-02: S3 Object (offsite)│   │
  │   │  Virtual Appliance   │  │  Scale-out Backup Repository │   │
  │   │  Transport Mode      │  │  (SOBR: tiering auto)        │   │
  │   └──────────────────────┘  └──────────────────────────────┘   │
  │              ↑ VADP (vStorage APIs for Data Protection)          │
  │   ┌──────────────────────────────────────────────────────────┐  │
  │   │  ESXi Cluster  │  vCenter  │  Veeam ONE (monitoring)    │  │
  │   └──────────────────────────────────────────────────────────┘  │
  └─────────────────────────────────────────────────────────────────┘

Transport Modes (ưu tiên theo thứ tự):
  1. Direct SAN Access            → Proxy kết nối trực tiếp SAN — nhanh nhất, FC/iSCSI
  2. HotAdd (Virtual Appliance)   → Proxy là VM trên cùng ESXi host — yêu cầu ESXi direct access
  3. Network (NBD)                → Qua VMkernel network — fallback, mọi môi trường
Component Sizing (100 VMs) Role Best Practice
Veeam Server4 vCPU, 16 GB RAMOrchestration, DB, UIDedicated VM, không kiêm proxy
Backup Proxy8 vCPU, 16 GB RAM × 2Data mover, dedup, compress1 proxy per 10-15 concurrent tasks
Repository (Primary)40 TB NFS / WindowsLưu backup filesReFS/XFS — block cloning tăng tốc
Repository (Offsite)S3-compatible3-2-1 rule, offsite copyS3 Object Lock immutability
Veeam ONE4 vCPU, 8 GB RAMMonitoring, reporting, SLATích hợp vCenter + Veeam B&R

2. Backup Job Policy theo RPO Tier — Gold / Silver / Bronze

Phân loại workload theo SLA tier và cấu hình Veeam job tương ứng — không áp dụng 1 policy cho tất cả VM.

SLA Tier RPO RTO Retention Veeam Settings Workload ví dụ
GOLD1 giờ1 giờ30 ngày + 12 thángBackup hourly + Replication 15minCore banking, ERP, DB chính
SILVER4 giờ4 giờ14 ngày + 6 thángBackup 4h, Replication dailyWeb app, email, file server
BRONZE24 giờ24 giờ7 ngày + 3 thángBackup daily, No replicationDev/Test, staging VMs
### Cấu hình Veeam Job — Gold Tier (PowerShell Veeam API)
# Tạo backup job cho Gold tier VMs

Add-VBRViBackupJob -Name "GOLD-Core-Banking-Backup" `
  -Entity (Find-VBRViEntity -VMsandTemplates -Name "WINDB-BANKING-PRD-*") `
  -BackupRepository (Get-VBRBackupRepository -Name "repo-primary") `
  -JobOptions (New-VBRJobOptions -BackupStorageOptions `
    (New-VBRBackupStorageOptions -RetainCycles 30 -EnableDeduplication $true `
                                  -CompressionLevel Optimal))

# Cấu hình retention GFS (Grandfather-Father-Son)
# Settings → Backup → Retention → Keep certain full backups longer: Weekly/Monthly/Yearly

Best Practice — Veeam Job Design

  • Dùng VM Tags để auto-include VMs mới vào đúng tier job — không cần thêm thủ công
  • Enable Application-aware processing cho SQL/Exchange/Oracle — đảm bảo consistent backup
  • Stagger backup windows: Gold 22:00, Silver 23:00, Bronze 01:00 — tránh đồng thời
  • Giới hạn max concurrent tasks per proxy = số vCPU / 2 để không overload

3. Replication Job cho DR Site — Cấu hình & Failover

Veeam Replication tạo VM replica tại DR site, cho phép failover nhanh khi production site gặp sự cố — không cần SRM license.

### Cấu hình Replication Job — Gold Tier VMs

# Veeam Console → Jobs → Replication → New Replication Job
#
# Source:       Production VMs (GOLD tier tag)
# Destination:  DR site vCenter (vcsa-dr.lab.local)
# Datastore:    ds-dr-prod-ssd
# Network:      Remapped: VLAN-100-Prod → VLAN-200-DR
# Restore points: 7 (giữ 7 bản replica)
# Schedule:     Every 15 minutes (RPO = 15 min)
# Seeding:      Full backup + incremental (WAN-optimized)

### Kiểm tra Replication Status
# Veeam Console → Replicas → Ready → xem lag time
# Target: replication lag < 5 phút
# Alert nếu lag > RPO threshold

### Thực hiện Failover (khi production DOWN)
# 1. Replicas → Right-click VM → Failover Now
# 2. Chọn restore point gần nhất
# 3. Veeam tự power on replica VM tại DR site
# 4. Update DNS/load balancer trỏ về DR IP
# Estimated time: 5-10 phút per VM

### Failback về Production (sau khi fix production)
# 1. Veeam → Failback to production
# 2. Chọn: từ replica → sync về production datastore
# 3. Commit failback → production VM tiếp quản

Network Remapping — Quan trọng

  • Production network (10.100.x.x) phải remap sang DR network (10.200.x.x) trong Replication Job
  • Cấu hình Re-IP rules nếu DR site dùng subnet khác — Veeam tự thay đổi IP trong guest
  • Giữ replica VM ở trạng thái powered off — chỉ power on khi test hoặc real failover

4. Instant Recovery Workflow — RTO trong vài phút

Instant Recovery cho phép khởi động VM trực tiếp từ backup file — không cần chờ restore đầy đủ. RTO: 2-5 phút thay vì 1-2 giờ.

### Instant Recovery — Quy trình thực tế

BƯỚC 1: Khởi động Instant Recovery
  Veeam Console → Backups → Right-click VM → Instant Recovery
  → Chọn restore point (gần nhất hoặc theo yêu cầu)
  → Target: cùng hoặc khác vCenter/datastore
  → Veeam mount backup file làm NFS datastore tạm thời
  → VM được power on trong vòng 2-3 phút

BƯỚC 2: Verify & Test
  → Kiểm tra VM boot thành công, app lên OK
  → Test connectivity: DB, DNS, app endpoint
  → Nếu OK → bắt đầu migrate về permanent storage

BƯỚC 3: Storage vMotion về Production Datastore
  Veeam: "Migration Wizard" → Migrate VM sang ds-prod
  Hoặc: vSphere Storage vMotion manual trong khi VM đang chạy
  → Quá trình diễn ra nền, VM không bị downtime

BƯỚC 4: Finalize (khi migration xong)
  → Veeam: "Stop Publishing" backup NFS mount
  → Cleanup: xóa NFS mount point tạm thời
  → Ghi log: thời gian recovery, restore point dùng, actual RTO

Instant Recovery vs Full Restore — Khi nào dùng gì

Dùng Instant Recovery khi:

  • - Production VM bị corrupt/crash
  • - RTO yêu cầu < 30 phút
  • - VM lớn (>1 TB) — tránh restore lâu
  • - Test recovery nhanh

Dùng Full Restore khi:

  • - Storage tạm thời không đủ
  • - Cần restore về hardware khác
  • - Long-term archive recovery
  • - VM cần tách biệt hoàn toàn

5. Veeam ONE — Monitoring & Alarm Integration

Veeam ONE cung cấp visibility toàn diện cho cả VMware infrastructure và backup jobs — dashboard, capacity planning và alerting tập trung.

Alarm Type Threshold Hành động tự động Notification
Backup Job Failed1 lần thất bạiRetry 3 lần, logEmail + Teams alert
Backup Lag > RPOLag > 1.5× RPOLog + escalatePagerDuty P2
Repository Space < 20%20% freeBlock new jobsEmail warning
VM không có backup > 25h25 giờLog vào reportDaily digest email
Replica lag > 2× RPO30 phút (Gold)Trigger full syncPagerDuty P1
### PowerShell — Kiểm tra SLA Compliance tất cả VMs
Connect-VBRServer -Server veeam-mgr.hoatranlab.io.local

# Tìm tất cả VMs không có backup trong 25 giờ
$cutoff = (Get-Date).AddHours(-25)
$vmsWithoutBackup = Get-VBRBackup | Get-VBRRestorePoint |
    Where-Object { $_.CreationTime -lt $cutoff } |
    Select-Object VMName, CreationTime, @{N='Lag(h)';E={[math]::Round(((Get-Date)-$_.CreationTime).TotalHours,1)}} |
    Sort-Object 'Lag(h)' -Descending

$vmsWithoutBackup | Format-Table -AutoSize
# Export báo cáo
$vmsWithoutBackup | Export-Csv "C:\Reports\SLA-$(Get-Date -f yyyyMMdd).csv"

6. SLA Compliance Reporting & Checklist Production

Báo cáo SLA hàng tuần/tháng gửi lên management — kết hợp checklist vận hành để không bỏ sót việc quan trọng.

Checklist hàng tuần

Checklist DR Drill hàng quý

Ransomware Protection — 3-2-1-1-0 Rule (Veeam Best Practice)

  • 3 bản sao backup
  • 2 media khác nhau (disk + cloud)
  • 1 bản offsite (S3 object storage)
  • 1 bản immutable (S3 Object Lock WORM)
  • 0 lỗi verify (SureBackup auto-verify)
  • Backup credentials tách biệt domain admin