[chef] Re: Re: Use EBS backed VM or Volume to store the mysql db on EC2


Chronological Thread 
  • From: Bryan Brandau < >
  • To:
  • Subject: [chef] Re: Re: Use EBS backed VM or Volume to store the mysql db on EC2
  • Date: Wed, 29 Feb 2012 09:48:31 -0600
  • Authentication-results: mr.google.com; spf=pass (google.com: domain of designates 10.50.181.228 as permitted sender) ; dkim=pass

You have some flexible options with EBS.  You can start a normal EBS backed instance and then just snapshot off of that.  You can use ec2-consistent-snapshot which I believe someone created a cookbook around on the community site.
http://alestic.com/2009/09/ec2-consistent-snapshot

You can also launch an EBS backed volume that does not delete the volume when it terminates.  When you launch an instance you pass in the -b with something like "-b ("/dev/sda1=:8:false")"
The false is for "delete-on-termination.  You could then mount this volume on future instances.  You'll still need to follow the same snapshot strategy.

Depending on what your app will be doing you might want to raid multiple EBS volumes together.  EBS can be variant with performance.
Here is an example:
#create 6 200GB EBS Volumes. These must be in the same zone you launched your instance
ec2-create-volume --size 200 --availability-zone us-east-1c
ec2-create-volume --size 200 --availability-zone us-east-1c
ec2-create-volume --size 200 --availability-zone us-east-1c
ec2-create-volume --size 200 --availability-zone us-east-1c
ec2-create-volume --size 200 --availability-zone us-east-1c
ec2-create-volume --size 200 --availability-zone us-east-1c
 
#Attach all 6 volumes to the instance created. Your vol-[ids] and -i id will be diggerent
ec2-attach-volume vol-6d3d1207 -i i-34fa12e4 -d /dev/sdh1
ec2-attach-volume vol-493d2412 -i i-34fa12e4 -d /dev/sdh2
ec2-attach-volume vol-453d212f -i i-34fa12e4 -d /dev/sdh3
ec2-attach-volume vol-212d244f -i i-34fa12e4 -d /dev/sdh4
ec2-attach-volume vol-123d245f -i i-34fa12e4 -d /dev/sdh5
ec2-attach-volume vol-1b3d1271 -i i-34fa12e4 -d /dev/sdh6
 
#We're going to software RAID all these volumes. Install some tools we'll need.
sudo apt-get install mdadm xfsprogs
 
#Configure the raid array using RAID0.
yes | sudo mdadm --create /dev/md0 --chunk=256 --level 0 --raid-devices 6 /dev/sdh1 /dev/sdh2 /dev/sdh3 /dev/sdh4 /dev/sdh5 /dev/sdh6
echo DEVICE /dev/sdh1 /dev/sdh2 /dev/sdh3 /dev/sdh4 /dev/sdh5 /dev/sdh6 | sudo tee /etc/mdadm.conf
echo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf
sudo mkfs.xfs /dev/md0
echo "/dev/md0 /volr xfs noatime 0 0" | sudo tee -a /etc/fstab
sudo mkdir /volr
sudo mount /volr
df -h
 
#Install some tools so we can use ec2-consistent-snapshot
sudo add-apt-repository ppa:alestic &&
sudo apt-get update &&
sudo apt-get install -y ec2-consistent-snapshot
ec2-consistent-snapshot --aws-access-key-id KEY \
--aws-secret-access-key SECRET --region us-east-1 \
--xfs-filesystem /volr vol-6d3d2407 vol-493d2423 vol-453d242f vol-353d245f vol-1b3d2471

On Wed, Feb 29, 2012 at 7:13 AM, Edward Sargisson < "> > wrote:
I use an instance store with the MySql data on a volume which gets mounted by Chef. Works well.

There is a script around to do persistent snapshots with MySql. I'd recommend finding that.

Cheers,
Edward


On Wed, Feb 29, 2012 at 4:22 AM, millisami r < " target="_blank"> > wrote:
Hi Chefs!

I'm developing infrastructure on EC2 using Chef and its standard application and database cookbook.

For the mysql database storage, I want some feedback on choosing what to setup.

If I fire up the instance with the EBS-backed store, then the db master will be an instance, or if I fire the instance-store VM, then I've to attach/mount a Volume to store the database data.

So, my question is which way to go? Can you share your experience if you have faced such situation?


@millisami
~Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com






Archive powered by MHonArc 2.6.16.

§