Cách dùng veeam backup v9 sao lưu v center appliance từ es xi host cũ và khôi phục sang esxi host
1. Cách dùng VEEAM Backup v9 sao lưu vCenter Appliance từ ESXi Host cũ và khôi
phục sang ESXi Host khác
Sau đây tôi giới thiệu 1 bài Labs thực hành về phương pháp sao lưu/ khôi phục hệ thống
VMware vSphere vCenter Server Appliance 6 thông qua công cụ Back/Restore chuyên
nghiệp – số 1 Thế giới VEEAM Backup Free version 9.
– Cách dùng VEEAM Backup Free v9 backup vCenter Appliance 6 từ 1 ESXi Host cũ và
khôi phục sang 1 ESXi Host khác
(Trường hợp: do không có Share Storage/SAN chung cho các ESXi Host, chỉ có 1 máy ảo
VM có hệ điều hành Opensource/MS Server như: Openfiler/FreeNAS hoặc WIndows
Server 2012 làm Software NFS)
Các bước chuẩn bị cho hệ thống VEEAM Backup:
Bước 1. Cách cấu hình VEEAM Backup Free v9
Tải bản ISO cài đặt VEEAM Backup Free v9
Cài hệ thống VEEAM Backup Free v9 xin tham khảo:
Cấu hình VEEAM Backup Free v9 trên 3 mô hình chính:
Cài trên 1 VM windows 2012 R2
Cài trên 1 Hyper-V và có windows 2008 R2/ W2K12/W2K12R2.
Cài .Net framework 4.5, SQL Express2013 Sp1
Bước 2. Cách viết script cho VEEAM Backup trên PowerShell v2
– Nội dung file VEEAMBackup.ps1 script:
##################################################################
# User Defined Variables
##################################################################
# Names of VMs to backup separated by comma (Mandatory). For instance, $VMNames
= “VM1”,”VM2”
$VMNames = “VCVA60”
# Name of vCenter or standalone host VMs to backup reside on (Mandatory)
2. $HostName = “10.10.11.80”
# Directory that VM backups should go to (Mandatory; for instance, C:Backup)
$Directory= “E:Backup_K2”
#Optionally, you can change compression level and desired retention, disable VMware
quiescence, enable encryption or even notification settings:
# Desired compression level (Optional; Possible values: 0 – None, 4 – Dedupe-friendly, 5
– Optimal, 6 – High, 9 – Extreme)
$CompressionLevel = “5”
# Quiesce VM when taking snapshot (Optional; VMware Tools or Hyper-V Integration
Components are required for this in the guest OS; Possible values: $True/$False)
$EnableQuiescence = $True
# Protect resulting backup with encryption key (Optional; $True/$False)
$EnableEncryption = $False
# Encryption Key (Optional; path to a secure string)
$EncryptionKey = “”
# Retention settings (Optional; by default, VeeamZIP files are not removed and kept in
the specifiedlocation for an indefinite period of time.
# Possible values: Never, Tonight, TomorrowNight, In3days, In1Week, In2Weeks,
In1Month)
$Retention = “Never”
#If you like to get an email report once the backup is completed, you should additionally
fill out the following notification settings.
##################################################################
# Notification Settings
##################################################################
# Enable notification (Optional)
$EnableNotification = $True
# Email SMTP server
$SMTPServer = “”
4. $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention
}
If ($EnableNotification)
{
$TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
$FailedSessions = $TaskSessions | where {$_.status -eq “EWarning” -or $_.Status -eq
“EFailed”}
if ($FailedSessions -ne $Null)
{
$MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object
@{n=”Name”;e={($_.name).Substring(0, $_.name.LastIndexOf(“(“))}} ,@{n=”Start
Time”;e={$_.CreationTime}},@{n=”End
Time”;e={$_.EndTime}},Result,@{n=”Details”;e={$FailedSessions.Title}})
}
Else
{
$MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object
@{n=”Name”;e={($_.name).Substring(0, $_.name.LastIndexOf(“(“))}} ,@{n=”Start
Time”;e={$_.CreationTime}},@{n=”End
Time”;e={$_.EndTime}},Result,@{n=”Details”;e={($TaskSessions | sort creationtime -
Descending | select -first 1).Title}})
}
}
}
If ($EnableNotification)
{
$Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
$Message.Subject = $EmailSubject
$Message.IsBodyHTML = $True
$message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
$SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
$SMTP.Send($Message)
}
Bước 3. Cấu hình PowerShell V2 cho phép chạy, read/write/executive trên máy chủ
Windows chạy bản VEEAM Backup Free v9.
Lưu ý khi lần đầu cài Microsft PowerShell vàchạy trên máy PC mới:
Gõ lệnh trên màn PowerShell / cmdlet / cmdDOS :
Get-PSSnapin
5. Gõ lệnh kiểm tra quyền chạy WinRM kết nối tới Office 365 (O365):
net start winrm
winrm get winrm/config/client/auth
Gõ lệnh cấu hình lại quyền chạy winrm (nếu kết quả báo: Basic=false):
winrm set winrm/config/client/auth @{Basic=”true”}
Một số trường hợp đặc biệt, máy PC của bạn đang join domain và bị Global
domain ngăn cản bằng các Policy domain hãy gõ lệnh sau để thiết lập quyền kết
nối và điều khiển Office 365 bằng PowerShell:
Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy Unrestricted
Nếu là bị GPO hạn chế quyền restrictedpolicy hãy gõ lệnh sau:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy unrestricted -force
Thêm vào đó 4 dòng lệnh sau:
Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy unrestricted -force
Set-ExecutionPolicy -Scope MachinePolicy -ExecutionPolicy unrestricted -force
Set-ExecutionPolicy -Scope UserPolicy -ExecutionPolicy unrestricted -force
Set-ExecutionPolicy -Scope Process -ExecutionPolicy unrestricted -force
Tham khảo link: https://thangletoan.wordpress.com/2013/08/08/su-dung-powershell-
trong-office-365/
Bước 4. Cấu hình Task Schedule trên Windows > Administrator Tool cho phép chạy
Script theo lịch trình thời gian (onTime, on daily, on weekly, on Monthly…)
6.
7. Bước 5. Kiểm tra history kết quả backup của VEEAM Backup Free v9
8. Phần khôi phục lại máy chủ ảo VCVA trên một ESXi Host khác, sau khi đã backup
VEEAM v9 thành công.
Bước 1.
– Mở VEEAM Backup chọn Menu HOME > chọn nút Restore
Chọn thư mục và tìm tới file đã backup máy chủ ảo VCVA
9. Chọn bản đã backup gần nhất để restore
Chọn kiểu Restore Entire VM
Chọn vị trí ESXi Host khác để restore VM
10. Chọn từ Host mặc định cũ: 10.10.11.80 và chuyển sang Host khác: 10.10.11.70
11. Đã chọn sang Host khác.
Cuối cùng là phần Datastore để chứa máy chủ ảo VCVA cần khôi phục, bạn sẽ phải trỏ
tới 1 trong các vùng lưu trữ như: DAS, SSD, Local storage, SAN, NAS, Share Storage
mà có thể kết nối thông với ESXi Host vừa trỏ tới.
12. Lưu ý: vùng trống để chứa và vận hành máy chủ ảo VCVA có kích thước tối thiểu:
(114,3 Gb + 8Gb (swap file for memory ~ 8Gram/1 VM)
Bước 2. Kiểm tra kết quả khôi phục:
13. Bước 3. Kiểm tra máy chủ ảo VCVA:
– Bật máy ảo vCenter Server 6 sau khi đã khôi phuc thành công từ VEEAM Backup
– Mở console vCenter Appliance 6 và kiểm tra tình trạng chạy ổn định
14. – Mở IE/FF kiểm tra web vsphere client
Chúc các bạn thành công với việc bảo vệ máy chủ vCenter Server Appliance an toàn.