TSF – Giải pháp IT toàn diện cho doanh nghiệp SMB | HCM

P12: How to Setup Cluster and Migrate VM in Proxmox – Step-by-Step Guide

🚀 Proxmox VE 9 – How to Setup Cluster and Migrate VM (Step-by-Step)

High Availability, centralized management, and live migration are some of the biggest advantages of running Proxmox VE in a cluster environment.

In this guide, you will learn how to:

  • 🖥 Create a Proxmox cluster

  • ➕ Add additional nodes

  • 🔄 Migrate virtual machines between nodes

  • ⚙ Understand how Proxmox clustering works

This tutorial is based on Proxmox VE 9 and follows best practices for lab and production environments.


🎯 Why Use a Proxmox Cluster?

A standalone Proxmox node works well. But once you need:

  • ✅ High Availability (HA)

  • ✅ Live VM Migration

  • ✅ Centralized management

  • ✅ Resource balancing

  • ✅ Production-grade virtualization

Then clustering becomes essential.

Proxmox uses:

  • 🔐 Corosync for cluster communication

  • 📦 pmxcfs (Proxmox Cluster File System)

  • 🌐 Secure SSH-based node communication


🧩 Cluster Requirements

Before starting, ensure:

  • All nodes run Proxmox VE 9

  • Nodes can ping each other

  • Static IP addresses are configured

  • Proper hostname resolution (via /etc/hosts or DNS)

  • Time is synchronized (NTP recommended)

⚠️ Important: Do not change hostname after cluster creation.


🖥 Step 1 – Create a Cluster on the First Node

On your primary node (for example: node1), run:

 
pvecm create my-cluster

Verify cluster status:

 
pvecm status

You should see cluster information including:

  • Cluster name

  • Node ID

  • Quorum status

At this point, your first node becomes the cluster master.


➕ Step 2 – Join Additional Nodes to the Cluster

On the second node (node2), run:

 
pvecm add <IP_of_node1>

You will be prompted for the root password of node1.

After successful join, verify on any node:

 
pvecm nodes

Or:

 
pvecm status

You should now see both nodes listed.

🎉 Congratulations — your Proxmox cluster is active.


🔎 Step 3 – Verify Cluster from Web GUI

Log into the Proxmox web interface:

 
https://NODE-IP:8006

On the left panel, you will now see:

  • Datacenter

  • node1

  • node2

Cluster is centrally managed under Datacenter view.


📦 Step 4 – Prepare Storage for Migration

For live migration, shared storage is recommended:

  • NFS

  • iSCSI

  • Ceph

  • ZFS over network

If using local storage only, migration will be offline (cold migration).

Ensure both nodes have access to the same storage.


🔄 Step 5 – Migrate VM Between Nodes

There are two ways to migrate a VM.


Option 1 – Using Web Interface

  1. Select the VM

  2. Click Migrate

  3. Choose target node

  4. Select migration type:

    • Online (live)

    • Offline

  5. Click Start

Proxmox handles the rest automatically.


Option 2 – Using CLI

Run:

 
qm migrate <VMID> <target-node>

Example:

 
qm migrate 100 node2

For offline migration:

 
qm migrate 100 node2 --online 0

⚙ How Live Migration Works

Live migration transfers:

  • Memory state

  • CPU state

  • Disk access (shared storage required)

The VM continues running with minimal interruption.

Downtime is typically less than 1 second in optimized environments.


🛠 Common Cluster Issues

Here are typical problems and solutions:

❌ No Quorum

Check:

 
pvecm status

Ensure at least 2 nodes are online (or use a QDevice for 2-node cluster).


❌ SSH Fingerprint Errors

Clear known hosts:

 
ssh-keygen -R <IP>

❌ Migration Fails Due to Storage

Ensure:

  • Same storage ID exists on both nodes

  • Shared storage is mounted correctly


🔐 Best Practices for Production

✔️ Use at least 3 nodes for stable quorum
✔️ Configure separate network for Corosync
✔️ Enable HA only after cluster stability
✔️ Monitor cluster health regularly
✔️ Backup before major migration

For enterprise environments, consider:

  • Dedicated 10Gb network for migration

  • Ceph distributed storage

  • VLAN separation


🧠 Understanding Quorum in Proxmox

Quorum ensures cluster consistency.

Formula:

 
More than 50% of nodes must be online

Examples:

  • 2 nodes → need 2 online

  • 3 nodes → need 2 online

  • 5 nodes → need 3 online

Without quorum, configuration changes are blocked.


🚀 What’s Next?

After setting up your cluster, you can explore:

  • 🔥 High Availability (HA) configuration

  • 🔥 Ceph storage integration

  • 🔥 Backup server integration

  • 🔥 Network bonding for redundancy

  • 🔥 VLAN configuration in cluster


🎯 Conclusion

Setting up a Proxmox VE 9 cluster unlocks powerful enterprise-grade virtualization features such as:

  • Live VM migration

  • High availability

  • Centralized management

  • Scalability

By following this step-by-step guide, you now have a working Proxmox cluster and understand how to migrate virtual machines safely between nodes.

Cluster deployment is a major milestone in any virtualization journey — especially if you are building a homelab or moving toward production-level infrastructure.

See also related articles

P15 – Backup and Restore VM in Proxmox VE

P15 – Backup and Restore VM in Proxmox VE 🚀 Proxmox VE P15 – Backup and Restore VMs (Full Step-by-Step Guide) Data protection is one of the most critical responsibilities of any system administrator.In Proxmox VE, having a proper backup and restore strategy ensures your infrastructure can quickly recover from...

Read More

P14 – How to Remove Cluster Group Safely on Proxmox

Proxmox VE 9 P14: How to Remove Cluster Group Safely In Proxmox (Step-by-Step Guide) 🚀 Proxmox VE 9 – How to Remove Cluster Group (Step-by-Step) In some scenarios, you may need to remove a Proxmox cluster configuration completely, especially when: ❌ A node failed permanently ❌ The cluster was misconfigured...

Read More