Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks that cleared it up. –  Trent Scott Sep 19 '11 at 8:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.