Migrating mySQL to EBS

15 Oct 2010 by Misha Dragojevic

This document explains how to migrate your existing Amazon EC2 mySQL DB to EBS storage.

You must have “EC2 API command line tools”, XFS file system utilities and mySQL server installed on your system.

Step 1: Install necessary software

On Ubuntu / Debian:

Make note of your "instance_id". *Step 2*: Create and attach EBS volume Create EBS volume:

Make note of “volume_id” returned.
Make sure volume is ready:

Attach volume:

Step 3: Format file system, mount EBS

Create XFS file system:

Mount EBS on "/mnt" mount point:

You can now use EBS for mySQL.
NOTE: to make sure file system is mounted after reboot, you need to change /etc/fstab by adding the following line:

*Step 4*: Configuring mySQL to use EBS Stop mySQL server:

Move mySQL files to EBS:

Create pointers to old files:

Mount EBS volume:

*Step 5*: Start mySQL server

You have mySQL DB running on Amazon EBS volume!
Next step is to make sure you do a regular snapshots.

blog comments powered by Disqus