Friday, August 27, 2010

Moving MySQL to a large EBS volume

I had to move a very large customer MySQL database used for data mining to a large EBS raid. Since following the usual documentation did not work for me, here are my notes: after following the standard instructions for setting up RAID 0 (EBS is robust enough that I see little reason to use error correcting RAID, but do so if you wish), I followed some of the instructions here for mapping the usual installation location for MySQL data to the RAID EBS volume and using some fstab trickery (copied from the linked article):
sudo mkdir /vol/etc /vol/lib /vol/log
sudo mv /etc/mysql /vol/etc/
sudo mv /var/lib/mysql /vol/lib/
sudo mv /var/log/mysql /vol/log/

sudo mkdir /etc/mysql
sudo mkdir /var/lib/mysql
sudo mkdir /var/log/mysql

echo "/vol/etc/mysql /etc/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /etc/mysql

echo "/vol/lib/mysql /var/lib/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/lib/mysql

echo "/vol/log/mysql /var/log/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/log/mysql
I then did an apt-get remove on MySQL, followed by an apt-get install of MySQL and everything that I wanted is now set up on the large EBS RAID volume and I could start the very long database import process.

No comments: