I have made with success a load balance between my Master and Slave ( Backup server ), to copy each hour the “root files” inside a copy, to be more clear to copy everything in the domain. THis is the code :
NB : for security raison, I replace my website name here by ( mydomain) and the IP of the backup server by ( xx.xxx.xxx.xx )
Now the important question is the following : As I’m using this code to copy everything inside my website folder in vhosts folder, is that possible to do the same with the database with something like the following ??
Please, oh, please don’t do that! There is proper replication in MySQL to do exactly this and keep it up-to-date in realtime, i.e., when you insert something to the master, it will directly thereafter be copied to the slave, all updates will be propagated immediately, etc. The only thing need to make sure is to write to the master only, not to any of the slaves.
With regards to copying the code, will it be updated so much that you need to copy it every 10 minutes? Isn’t it possible that when you put some new code only to deploy to both servers at once? There are a lot of deploy tools out there that could easily do that for you, like phing or capistrano.
If you don’t want to use a build tool I’d at least look at inotifywatch to see when files have changed so you can rsync them over instead of rsyncing all files every 10 minutes.
Thank you so much ScallioXTX for your feedback and advice, I will follow the tutorial that you mentioned on digitalocean.
[quote=“rpkamp, post:2, topic:116618”]
will it be updated so much that you need to copy it every 10 minutes?
[/quote] oh I thought it will be updated each hour, how can I fix that ?
To be honest, I dont know them, but I will take a look, to have an idea how they work and if they are cheap.