I'm creating several LAMP servers on Amazon EC2. I'd like to put Apache and MySQL on separate EBS (attached) volumes for persistent storage.
From what I've read, people do one of the following:
(a) physically move the core files for Apache/MySQL to an XFS-formatted EBS volume (e.g. sudo mv /etc/mysql /vol/etc/, etc.).
(b) symbolically link their core files to the EBS volume (e.g. mkdir -p /ebs/var/lib/mysql and then ln -s /ebs/var/lib/mysql /var/lib)
Can you explain why someone would choose option B? Isn't it a better idea to have your data off the EC2 instance and onto EBS from the get-go?
Answer
Here's an article I wrote for Amazon back in the early days of EBS outlining generally accepted best practices from the community:
Running MySQL on Amazon EC2 with EBS
http://aws.amazon.com/articles/1663
The referenced AMI id is old and should not be used, but the core concepts in the article are still valid and are in popular use today.
Rather than (a) or (b) in your question, I think folks are probably doing (a) and (b). You need to get the database on to the EBS volume, then you need to have MySQL be able to access them in their new location.
Though symlinks or configuration editing can be made to work, I tend to use mount bind as described in the above article. This avoids problems with AppArmor if it's running on your distro.
No comments:
Post a Comment