Proxmox VE Advanced: Cluster, Live Migration & HA
1. Create the Cluster
With 2 PVE hosts ready (e.g., 192.168.231.131 and .10), on the main host, go to Datacenter > Cluster > Create Cluster.
Name the cluster (e.g., Cluster-PVE-Lab) and create it.
Click Join Information to get the join string.
On the 2nd host, go to Datacenter > Cluster > Join Cluster.
Paste the information and enter the password of the 1st node.
Refresh the page to see both nodes.
2. Add Shared Storage (iSCSI)
Prepare the Shared Storage (e.g., TrueNAS iSCSI share).
On Proxmox, go to Datacenter > Storage > Add > iSCSI.
Enter ID and Portal IP. The Target should auto-appear.
The storage will appear in the list.
3. Create VM (Ubuntu)
Click Create VM.
Step-by-Step Configuration:
- General: Node, VM ID, Name. Check 'Add to HA'.
- OS: Select ISO Image, Type Linux.
- System: SCSI Controller (VirtIO SCSI single).
- Disks: Storage (Shared), Check 'SSD emulation'.
- CPU: Cores, Type.
- Memory: Check 'Ballooning Device'.
- Network: Bridge, Model.
Confirm and Finish.
4. Create Container (LXC)
Click Create CT.
Step-by-Step Configuration:
- General: Uncheck 'Unprivileged container', Check 'Add to HA'.
- Template: Select Ubuntu template.
- Disks: Disk size (e.g., 32GB).
- CPU: Cores assignment.
- Memory: RAM and Swap.
- Network: DHCP (usually).
- DNS: Host settings.
Confirm and Start.
5. Live Migration
Migrate VM (Online)
Right click VM > Migrate.
Target node, Mode: Online.
Task OK logs.
Migrate Container (Restart)
Right click CT > Migrate.
Mode: Restart Mode.
6. High Availability (HA)
Datacenter > HA > Affinity Rules > Add.
Add Resources and Priority.
Test Failover
Simulate crash on the node hosting VMs.
echo b > /proc/sysrq-trigger
Services go unresponsive initially.
On surviving node, force quorum: pvecm expected 1.
Proxmox VE Nâng cao: Cluster, Live Migration & HA
1. Tạo Cluster
Với 2 host PVE sẵn sàng (ví dụ .131 và .10), trên host chính vào Datacenter > Cluster > Create Cluster.
Đặt tên Cluster (ví dụ: Cluster-PVE-Lab) và tạo.
Nhấn Join Information để lấy chuỗi kết nối.
Trên host thứ 2, vào Datacenter > Cluster > Join Cluster.
Dán thông tin và nhập mật khẩu root của node 1.
Tải lại trang để thấy cả 2 node.
2. Thêm Shared Storage (iSCSI)
Chuẩn bị Shared Storage (ví dụ: TrueNAS iSCSI).
Trên Proxmox, vào Datacenter > Storage > Add > iSCSI.
Nhập ID và Portal IP. Target sẽ tự hiện.
Storage sẽ hiện trong danh sách.
3. Tạo VM (Ubuntu)
Nhấn nút Create VM.
Cấu hình từng bước:
- General: Node, VM ID, Name. Tích 'Add to HA'.
- OS: Chọn ISO Image, Type Linux.
- System: SCSI Controller (VirtIO SCSI single).
- Disks: Storage (Shared), Tích 'SSD emulation'.
- CPU: Số Cores, Type.
- Memory: Tích 'Ballooning Device'.
- Network: Bridge, Model.
Xác nhận và Hoàn tất.
4. Tạo Container (LXC)
Nhấn nút Create CT.
Cấu hình từng bước:
- General: Bỏ tích 'Unprivileged container', Tích 'Add to HA'.
- Template: Chọn Ubuntu template.
- Disks: Dung lượng (ví dụ 32GB).
- CPU: Gán Cores.
- Memory: RAM và Swap.
- Network: DHCP (thường dùng).
- DNS: Cài đặt Host.
Xác nhận và Start.
5. Live Migration
Di chuyển VM (Online)
Chuột phải VM > Migrate.
Target node, Mode: Online.
Log báo Task OK.
Di chuyển Container (Restart)
Chuột phải CT > Migrate.
Mode: Restart Mode.
6. High Availability (HA)
Datacenter > HA > Affinity Rules > Add.
Thêm Resources và Priority.
Test Failover (Giả lập sự cố)
Giả lập crash trên node đang chứa VM.
echo b > /proc/sysrq-trigger
Dịch vụ ban đầu sẽ mất kết nối.
Trên node còn sống, ép quorum: pvecm expected 1.