Amazon Elastic Block Store(EBS)ã§mysqlãåããã¦ã¿ãã
Good job, Amazonã¨ãããã¨ã§ãå®éã«ãã£ã¦ã¿ã¾ããã
詳ããã¯
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1663&categoryID=100
ãåç
§ãã¦ããã ããã°ã¨æãã¾ãããæ¥æ¬èªã®æ¹ãè¯ãã¨ããæ¹ã¯ãã¡ãããåèã¾ã§ã«ã
$ã§å§ã¾ãã³ãã³ãã¯ã¯ã©ã¤ã¢ã³ãã®terminalããã
#ã§å§ã¾ãã³ãã³ãã¯ECãµã¼ãã¼ã§å®è¡ã
ã¨ããããããã¹ãç®çãªã®ã§ãã¼ãããEC2ã¤ã³ã¹ã¿ã³ã¹ãä½ãã¨ãããããã£ã¦ãã¾ãã
ã¤ã³ã¹ã¿ã³ã¹èµ·åã¨ãã¼ã確èª
ã¨ãããããåèªèº«ã¯ä¸çªcentosãæ
£ãã¦ããã®ã§ãããAmazonãªãã£ã·ã£ã«ã®ã¤ã¡ã¼ã¸ã«centosãç¡ãã®ã§ãrightscaleãæä¾ãã¦ããã¤ã¡ã¼ã¸ã使ããã¨ã«ã
詳ããã¯
http://vividtone.seesaa.net/article/97841106.html
ãåç
§ã®ä¸ãèªåã«æé©ãªã¤ã¡ã¼ã¸ã使ã£ã¦ãã ããã
åã®å ´åã¯ãami-5c08ed35ã使ãã¾ããã
$ ec2-describe-images -x all | grep rightscale
$ ec2-run-instances ami-5c08ed35 -k mymachine
$ ec2-authorize default -p 22
$ ec2-describe-instances
inctance idãã¡ã¢ããi-xxxxxxã¨æ¸ãã¾ãã
zoneãã¡ã¢ããus-east-1bã¿ãããªãã®ã
sshã§æ¥ç¶
$ ssh -i mymachine.id [email protected]
installç³»
ã¨ããããmysqlã¨ãã¡ã¤ã«ã·ã¹ãã ãä½ãããã«xfsãã
æ¬å½ãªãã½ã¼ã¹ããã¡ããã¨å
¥ãããã§ãããé¢åãªã®ã§yumã§éãããããã¾ã§ãã¹ãç®çã
EBS volumeãä½ã£ã¦attachãã
$ ec2-create-volume -z us-east-1b -s 1
us-east-1bã®é¨åã¯EC2ãèµ·åãã¦ããzoneãæå®ããæ¹ããããã¨ã
æå¾ã®1ã¯1GBåã®volumeãä½ãã¨ããæå³ã§ãã
vol idãã¡ã¢ããvol-xxxxxxã¨æ¸ãã¾ãã
$ ec2-describe-volumes vol-xxxxxx
$ ec2-attach-volume -d /dev/sdh -i i-xxxxxx vol-xxxxxx
ãã¦ã³ããã
# mkfs.xfs /dev/sdh
# echo "/dev/sdh /vol xfs noatime 0 0" >> /etc/fstab
# mkdir /vol
# mount /vol
mysqlã®ãã¼ã¿ã移åãã¦ãè¨å®ãã¡ã¤ã«ãæ¸ãæãã¦ã³ãã¼
mysqlãåãã¦ããå ´åã¯mysqlãä¸æ¦æ¢ãã¦ãmysqlã®datadirãå ¨é¨/vol/log/mysql/ã«ã³ãã¼ã
# /etc/init.d/mysqld stop
# mkdir /vol/log /vol/log/mysql
# mv /var/lib/mysql/* /vol/log/mysql
è¨å®ãã¡ã¤ã«ãæ¸ãæãã
以ä¸ã®2è¡ã¯æ¬å½ã«æå°é度ã®ãã®ã§ãã£ã¦ãbin-logã¨ãslow-query-logã¨ãã¯åãæãã§æ¸ãæãã¦ãã ããã
# vi /etc/my.cnf
- -
åèµ·åãã¦ãDBãä½ãããã¨ã確èªã
# /etc/init.d/mysqld start
# mysql -p -e 'CREATE DATABASE tutorial_sample'
# mysql -p -e 'SHOW DATABASES'
EBS volumeãdeleteï¼ä½ã£ãã¾ã¾ã ã¨ãéããã£ã¡ããããï¼
# /etc/init.d/mysqld stop
# umount /vol
$ ec2-detach-volume vol-xxxxxx
$ ec2-delete-volume vol-xxxxxx
EC2ã¤ã³ã¹ã¿ã³ã¹ãdelete
$ ec2-terminate-instances i-xxxxxx
確èª
$ ec2-describe-instances
$ ec2-describe-volumes