We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Synchronize 2 or more VestaCP Server
Synchronize 2 or more VestaCP Server
Hi, I'm running vestacp on a VPS server. I'd like to clone that VPS with a VestaCP installed and be able to keep the two synchronize. The two sync'd servers would be behind a Load Balancer so if one VestaCP server goes down or have access issue the Load Balancer would send traffic to second VPS running. Has anyone done something like this?
It be nice if VestaCP had tools to cluster the vestacp install and keep the cluster in sync. Appreciate any feedback!
It be nice if VestaCP had tools to cluster the vestacp install and keep the cluster in sync. Appreciate any feedback!
Re: Synchronize 2 or more VestaCP Server
Not sure it's easy to setup it.
Even if you install Vesta on second machine, and after install you clone /usr/local/vesta with rsync... probably you also have to clone /etc, and to resync both folders everytime you change something in hosting setup.
Also you need to sync both mysql servers (mysql have it's own syncing mechanism)...
And with some magic you have to sync /home everytime SOMETHING change/add/remove SOME FILE in /home ...
Probably cloud have better sync solution for files.
Even if you install Vesta on second machine, and after install you clone /usr/local/vesta with rsync... probably you also have to clone /etc, and to resync both folders everytime you change something in hosting setup.
Also you need to sync both mysql servers (mysql have it's own syncing mechanism)...
And with some magic you have to sync /home everytime SOMETHING change/add/remove SOME FILE in /home ...
Probably cloud have better sync solution for files.
Re: Synchronize 2 or more VestaCP Server
Yes it's possible but it really depends how you implement it.
Server
If you use rsync (there are better solutions) you have to make sure you replicate the exact same directories to the slave machine, and you can make it do this by using rsync and running it every 5 minutes - not ideal but for a small server it will work well with a 5 minute delay. If you exclude rsync from copying MySQL and let MySQL handle that that will work well. The problems lie when for example server 1 goes down there's a 5 minute gap of missing content, and of course the slave FTP can't be changed / vesta because of the mismatch. The master is the main server what handles content changes then replicates it (excluding MySQL as this can handle master -> slave and vice versa).
Website
You can use rsync on cron every 5 minutes to replicate the /home/<user>/ directory to the slave server and let MySQL handle the replication too. This means you have to set up the website on the master and slave manually so if the master goes down people will still see the website on the slave machine.
Server
If you use rsync (there are better solutions) you have to make sure you replicate the exact same directories to the slave machine, and you can make it do this by using rsync and running it every 5 minutes - not ideal but for a small server it will work well with a 5 minute delay. If you exclude rsync from copying MySQL and let MySQL handle that that will work well. The problems lie when for example server 1 goes down there's a 5 minute gap of missing content, and of course the slave FTP can't be changed / vesta because of the mismatch. The master is the main server what handles content changes then replicates it (excluding MySQL as this can handle master -> slave and vice versa).
Website
You can use rsync on cron every 5 minutes to replicate the /home/<user>/ directory to the slave server and let MySQL handle the replication too. This means you have to set up the website on the master and slave manually so if the master goes down people will still see the website on the slave machine.
Re: Synchronize 2 or more VestaCP Server
But keep in mind that rsync makes high cpu load... and disk usage too... not so much useful for large /home folder on every 5 minutes :/
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Synchronize 2 or more VestaCP Server
This is Called High Availability Setup and is a complicated procedure.
You need to setup HA with GlusterFS to Sync files & galera cluster for MySQL DB Sync. you will also need to setup heartbeat and Failover IPs. You may need a hosted DNS like AWS Route53 which can switch traffic automatically.
If you can afford some downtime, you can just install 2 servers, configure exact sites & DB in 2, then upload Backup from Server 1 to server 2 like once daily or twice daily.
In an event server 1 fails, you goto Server 2, restore Site files and DB from the last backup that was uploaded by server 1 and point your DNS's A record to Server 2. There will be some downtime depending on how much time you take to restore the DB.
You need to setup HA with GlusterFS to Sync files & galera cluster for MySQL DB Sync. you will also need to setup heartbeat and Failover IPs. You may need a hosted DNS like AWS Route53 which can switch traffic automatically.
If you can afford some downtime, you can just install 2 servers, configure exact sites & DB in 2, then upload Backup from Server 1 to server 2 like once daily or twice daily.
In an event server 1 fails, you goto Server 2, restore Site files and DB from the last backup that was uploaded by server 1 and point your DNS's A record to Server 2. There will be some downtime depending on how much time you take to restore the DB.