Published 3 months ago by Spartaque07
Hello guys, at last time I reading documentation, I found some interesting things: https://monosnap.com/file/USr6mNcsSHbQbj5Ec8l1h29Q5vG7Ik
As I understand correctly, Laravel can work with replicated database from the box. But I haven't some experience to do replication. But now, I'm very interesting in this because this is written at Laravel documentation). Please anybody know anything about this? Maybe some links for discussion will be great for me. I must do this)
I suggest you look into Galera Replication using something like MariaDB.
Here's a starter for you: https://mariadb.com/kb/en/library/getting-started-with-mariadb-galera-cluster/
Personally, I find this a lot easier: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.MultiAZ.html
It has your (main) db in one region, and a up-to-date backup in another that is synced in realtime. If something happens to the main one, it automatically switches to the other. So it solves 2 problems. It backs up your data in multiple places (goodbye database backups), and automatically switches the one to be the "main" server if there is a problem. That can save a lot of time, and your users only get db errors for a few seconds while it's switching, if that ever happens.
It's not really necessary with that service. We have almost 30 million records in it serving about 12 million requests/month so far and I know others who have a lot more. We've just vertically scaled our instances when we hit about 80% capacity.
You can also create multiple instances and link them together in master/slave situations, but we haven't needed to. We have 4 app servers behind a load balancer all using it.
Hmm, Very interesting. I want to understand how to use master/slave on real world, but on my MAC is not so easy as on LINUX. Do you scale on Forge your application or use custom config for nginx load balancing? And for me it's interesting, do you use QUEUE in application (default Redis with Horizon, or maybe Amazon SQS or other)? And do you use Cache for reduce SQL queries? And why you choose Amazon instead of DigitalOcean? It's very interesting for me)