So it worked. From everything i could tell...and it was very easy to setup. In fact, if you already have a MySQL slave running you can even move it to an S3 mount with ease. Here's what I did:
- Setup MySQL slave by making a "my_slave.cnf" file and making a new folder in the same area the mysql master is, but just named it mysql_slave instead. Then matched that in the cnf file so that the datadir was pointed there and the socket. Then also included the necessary settings to make it a slave (and the my.cnf file a master). Started it, started slave, voila. So if you follow MySQL's site's intstructions you'll be ok.
- Then...I setup ElasticDrive and mounted S3 as a partition. Also fairly straight forward. I mounted using the "direct network storage" method/use case as described in the readme for ElasticDrive (not RAID).
- Then I created a directory on the S3 mount, chown it to mysql:mysql, shut down the slave, copied the entire directory on the EC2 instance where the slave was to the new directory on the S3 mount (again making sure the ownership is mysql:mysql and making sure all paths matched up as I defined in the my_slave.cnf file.
- Then I restarted the MySQL slave server. It automatically started up where it left off...no issuing of any commands to change master or start slave. It just picked up as if it never was shut off. Of course I also didn't do any writing to the master during this time period. If I had...I'm sure I would have had to resync the databases.
- I tested. I wrote the post below.
- I shut down the slave on S3...I tried starting up the slave server restoring the my_slave.cnf I created to run off the EC2 instance location...of course it had an error and couldn't start (because it was out of sync).
- I then removed the mysql_slave diretory on the EC2 instance and copied it over from the S3 mount. Restarted the slave server and voila. It picked up like nothing ever went wrong.
So that's it folks. It's EXTREMELY easy...but what wouldn't be easy is if you were doing this on a site that was constantly being updated. You'd have to stop all writing to the master DB for the brief period of time it would take to setup a new slave. If no data has been written since the time the slave went down...you'd be in great shape. It took less than 5 minutes to copy files and setup that slave again. On the other hand, if the master is out of sync with the slave...you'd have to do a database dump and setup the slave all over again (following the instructions off the MySQL site). The change master and start slave commands, etc. Not a super big deal, but also not as quick.
What I really liked about this was that changing the location of the slave was extremely easy (stopping, editing 2 lines in a cnf file, starting again) and fast.
What I don't like so far about having the MySQL slave on the S3 mount using ElasticDrive is that the requests are racking up. To me it seems like I'll rack up S3 costs in requests and not from storage or transfer. It seems like ElasticDrive makes a rediculous amount of requesets (during this test period and moving of files, etc. I seemd to have charged about 1-2 cents in requests..but that's for what? 30 min tops?)
The next thing I need to find out is if there's a more efficent way ElasticDrive (or another solution) can work with S3 so the requests aren't out of hand...or what I REALLY wish was that there would still be support for AOL's XDrive (which has 5GB free)...or that Google/Yahoo/whoever would jump on the bandwagon and some sort of free solution ... or at least free requests, would be available.
Pretty cool and pretty powerful stuff though if I was running a site and had the budget to tack on another 2-4 cents an hour on top of the 10 cents an hour from the EC2 instance...and of course the transfer/storage (which wouldn't amount to anything unless the database was huge).
Admin