haswitch is a Linux high availability tool to manage VM synchronization in a RAID 10 environment (machine-to-machine). Its primary goal is to switch LXC virtual machines onto LVM + DRBD. Its secondary goal is to manage the network coming with virtual machines then it manages iptables and bridges. haswitch also supports OVH's failover API which allow to switch failover ip during the migration.
Install
sudo npm install -g haswitch
Operations
Show configuration
haswitch show
Start all resources
haswitch start
Stop ha0 resource
haswitch start ha0
Start VM vm1ha0 on ha0 resource
haswitch start ha0 vm1ha0
Stop VM vm1ha0 on ha0 without execution
haswitch -e stop ha0 vm1ha0
LXC
Install LXC
sudo apt-get install lxc lxc-templates wget bridge-utils
Prepare LXC
Disable the default bridge “lxcbr0“, got created as part of LXC installation.
sudo nano /etc/default/lxc-net
Set “USE_LXC_BRIDGE” to “false“.
USE_LXC_BRIDGE="false"
DRBD
I suggest you to follow the guide from Zarafa:
The DRBD resource name must have the same name as a haswitch resource.
ISP Integration
OVH
Edit your /etc/haswitch.json and add:
ovh:
Customer Key will come after running the credential checker.
haswitch ovh auth
A validation URL will be given You will have to follow it in order to activate the application. Once you have done that you will have the customer key:
ovh:
Now you have to activate OVH failover on the LXC container
Once you have configured you can check the OVH's failover status:
haswitch ovh check
To redirect all failover IP in every resources on Me (see ovh.me):
haswitch ovh failover
Or for a specific resource:
haswitch ovh failover ha0