How to sync 2 cloned web server to each other

I don’t know this is related to hestiacp or not, and I am asking this question to right place or not. If my query is unrelated, this please forgive my foolishness.

I currently do an experiment with my Hestiacp server.

I have 2 web, and mail server with hestiacp (first is server 1)
Then I make exact copy of this server to different machine (server 2) and set this 2 machine as load balancer and backup, means the traffic is distributed to both this 2 server.
To do this I set another machine/server as proxy server using HAProxy (server px) and connect this 2 webserver to haproxy server.
So the setup is working fine, the load are balanced and 2nd server act as backup too.

But I have one problem these 2 web server is not synced means if any kind of changes happen to any 1 server doesnt reflect to other server, so both web server is actually work individually.

Actually I don’t know how to sync them (noob sorry) so if any change happen to 1 server automatically change in other server too.

So does any one know how to do it, how to sync both cloned web server please tell me if possible.

You can use custom mounting stuff.

1 Like

Use rsync for file synchronization. This tool allows you to efficiently sync files and directories between servers.

For your databases, consider using a MariaDB Galera Cluster. This will enable real-time replication between the two servers.

I recommend considering a stateless application architecture using Docker for horizontal scaling.

2 Likes

Thanks you solutions are similar like shared storage for server, well that’s good solution and better for long run, but that need me more machines/instances/nas so I will do in future but thanks for this solution though.

Thanks for reply @alber . Well rsync is good option and I want to do it, except for database for database I use other option. And for docker scaling I am sorry but I am not good at docker so I leave this.

Rsync is good for me but I don’t know which directory I need to sync, if you or anyone tell me that what what directory I need to sync that cover everything created from hestiacp (like websites, accounts, settings, setup, mail server and mails , other directory which connect or need for hestiacp services etc) then it’s help me lot.
Please

And except database I don’t sync database by rsync for database I use MariaDB Galera Cluster as you suggested . So except database directory everything related to Hestiacp I am gonna rsync.

Thanks again

1 Like