A while ago, I wrote a snippet about MySQL replication. Well, I finally started playing with it not long ago, and was very successful. Apparently it works well, even for someone who hasn’t set it up before. Nice. I haven’t actually set this up on beeets because we don’t need it yet, and also I haven’t played with it enough to feel confident using it on a production basis.
That said, our Lyon Bros aframe framework now supports replication. It sends selects to the slave, writes to master, last_id to master, transactions to master, etc. Basically the only thing that slaves get are dumb selects (which are most of the queries anyway). I had the opportunity to test this out with the play MySQL replcation setup, and it works perfectly. It was nice to see something that complicated actually working.
Right now, it only supports connecting to two servers: master and slave (it holds off on connecting to those servers until one of them actually gets a request to save time on request startup). Basically, aframe doesn’t support load balancing. This means that if you have more than one master or slave, to use replication effectively, you’ll have to use a MySQL replication load balancer (either software or hardware). This will give you a single IP address to send requests to, but distribute the requests automatically to improve load times.
Hopefully we’ll need to set this up soon, but for now, just the one MySQL server will do =). Sometime within the next few months, we plan on releasing aframe as open source. It’s licensed and ready to go, but we have no documentation…and just saying “check out CakePHP and hope it works the same” won’t fly…especially since aframe is 23,148,855,308,184,500x better than Cake.
One thing I’d like to check out on round two of replication tinkering is Maatkit. From what I hear, it automates a lot of stuff I would be writing scripts for and checking every day. I looked at it a while ago and it seemed overly complicated, but that was even before I tried to get a server replicated. Maybe nowadays it would be easier.