Prerequisites
High availability requires multiple VPS instances. This is an advanced topic.
Before starting, make sure you have:
- At least two VPS servers
- Root or sudo access on all
- Load balancer knowledge
Option 1: DNS Failover (Simple)
Use a DNS provider with failover (e.g., Cloudflare, Route53).
Set two A records with low TTL (e.g., 60 seconds) and enable monitoring.
Option 2: Floating IP with Keepalived
Install keepalived:
sudo apt install keepalived -y
Configure on primary (master):
sudo nano /etc/keepalived/keepalived.conf
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass yourpassword
}
virtual_ipaddress {
192.168.1.100/24
}
}
On backup, set state BACKUP and priority 90.
Start keepalived on both.
Option 3: Load Balancer (HAProxy) + Two Backend VPS
Install HAProxy on a separate VPS or use two with floating IP.
sudo apt install haproxy -y
Configure /etc/haproxy/haproxy.cfg:
frontend http_front
bind *:80
default_backend http_back
backend http_back
balance roundrobin
server web1 VPS1_IP:80 check
server web2 VPS2_IP:80 check
Option 4: Database Replication (Already covered in Article 47)
Set up master-master or master-slave replication.
Option 5: Use Hostxpeed Load Balancer (If Offered)
Contact Hostxpeed to inquire about load balancing services.
✅ High availability configuration started. Test failover scenarios before production use.