# High Availability

High Availability (HA) ensures that critical VMs are automatically restarted on another node if the node they are running on fails.

Prerequisites:

- A working cluster with at least 3 nodes
- Shared storage accessible by all nodes (so the VM disk can be accessed after failover)
- The HA manager service must be running on all nodes

<span style="color: rgb(224, 62, 45);">Note</span>: HA requires a quorum (majority of nodes must be online). With 3 nodes, you can tolerate 1 node failure. With 2 nodes, there is no quorum and HA will not function.

#### Enabling HA for a VM

1. Go to Datacenter &gt; HA
2. Click Add under Resources
3. Select the VM ID you want to protect
4. Set the HA State:  
     • Started — HA will always try to keep this VM running  
     • Stopped — HA will manage the VM but leave it stopped  
     • Disabled — HA does not manage this VM
5. Set Max Restart — how many times to try restarting on the same node before migrating
6. Set Max Relocate — how many nodes to try before giving up
7. Click Add

#### HA Groups

HA groups define which nodes are preferred or required for specific VMs.

1. Datacenter &gt; HA &gt; Groups &gt; Add
2. Name the group and select nodes
3. Set priority (higher = preferred) for each node
4. Assign a VM to the group in HA Resources

#### Testing High Availability

1. Start an HA-protected VM on one node
2. Simulate a node failure by powering off that node or running:

```bash
systemctl stop pve-cluster corosync
```

Watch the Proxmox web console — the VM should automatically start on another node