Do Not Think!!!

Posted
Filed under 01010101

1. Create EBS Volume

2. Attach the EBS volume

3. Create a file system and mount

4. Configuring MySQL to use the EBS volume

참고: http://aws.amazon.com/articles/1663





1. Create EBS Volume

EBS 볼륨을 생성합니다.
사용자 삽입 이미지



2. Attach the EBS volume

사용자 삽입 이미지
사용자 삽입 이미지



3. Create a file system and mount

[CODE]$ sudo apt-get install -y xfsprogs
$ grep -q xfs /proc/filesystems || sudo modprobe xfs
$ sudo mkfs.xfs /dev/xvdf

$ echo "/dev/xvdf /vol xfs noatime 0 0" | sudo tee -a /etc/fstab
$ sudo mkdir -m 000 /vol
$ sudo mount /vol[/CODE]



4. Configuring MySQL to use the EBS volume

MySQL 중지
[CODE]$ sudo /etc/init.d/mysql stop[/CODE]

MySQL 데이터 디렉토리 옮기기
[CODE]$ 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[/CODE]

MySQL 시작
[CODE]$ sudo /etc/init.d/mysql start[/CODE]

테스트
[CODE]$ mysql -u root -p[/CODE]