DIY ¸®´ª½º À¥ ¼¹ö Àü¼¼ ¸¶Â÷ - ´ç½ÅÀÇ MySQL MySQL µ¥ÀÌŸº£À̽º ¹é¾÷À» ÀÚµ¿ÈÇϽʽÿÀ
ÁÁ¾Æ¿ä ³ª´Â ÇÑ ½Ö ¼ö³â°£ Àü¿ë ¼¹ö¸¦ Áö±Ý ´Þ¸®°í ÀÖ´Ù ±×¸®°í ³ª´Â ´ëÇп¡¼ ÈÄ¿¡ ¸®´ª½º »óÀÚ·Î ÁÖº¯¿¡ Èð¶ß·È¾ú´Ù.
¿©±â¿¡¼ ÀÖ´Ù ´ç½ÅÀÇ ¹é¾÷À» ÀÚµ¿À̶ó°í À¯ÁöÇÒ ´ç½ÅÀÌ Çʿ䰡 ÀÖÀ» cron ÀÏ ¹× ±Ùº»ÀûÀÎ ÀÚµ¿ ¿øº».
´ç½ÅÀÌ Àü¿ë ¼¹ö¸¦ ¾ò´Â °æ¿ì¿¡, ±×·¸½À´Ï´Ù ´ç½ÅÀÇ µ¥ÀÌŸº£À̽º º¸¿ÏÀ» À§ÇÑ ±×µéÀÇ ¾î¸®¼®Àº ¿©ºÐ $15/month¸¦ ¾òÁö ¸»¶ó. (¸ðµÎ´Â ¸¸µé°í ÀÌ °Í °°ÀÌ ¿øº»À» À§Å¹ÇÑ´Ù ±×°ÍÀ» À§ÇØ ´ç½ÅÀ» ÀÌ´Ù)
´ç½ÅÀº ÀÌ º¸±â¸¦ µû¸¦ ¼ö ÀÖ°í °¡±â À§ÇÏ¿© °£½Ä Àú µ·¿¡ ¼ÒºñÇϽʽÿÀ.
´ç½ÅÀÌ ¿ÀÁ÷ ÇØ¾ß ÇÏ´Â ÀÌ·¸°Ô °ÍÀº FTP ´ç½ÅÀÇ ¹é¾÷ ÆÄÀÏÀÌ´Ù.
À̰ÍÀº ÆÄÀÏÀÌ ÀÌ¹Ì ´Ù¿î·ÎµåÇÏ°Ô ´ç½Å ÀÌ ÁغñµÇ¾î Àֱ⠶§¹®¿¡ÀÌ¾î ´ç½ÅÀÇ phpMyAdmin·Î µé¾î°¡°í ¹× À¥ °ø¿ë¿µ¿ª¿¡¼ ´Ù¿î·ÎµåÇϱ⠺¸´Ù´Â ´õ ³ªÀº ¹æ¹ý.
¿©±â¿¡¼ ´ç½ÅÀÌ ±×°ÍÀ» ÇÏ´Â ¹æ¹ý ÀÌ´Ù:
1) ºÒ¸° »õ ÆÄÀÏÀ» ¸¸µå½Ê½Ã¿À backup.sh ´ç½ÅÀÇ È¨ µð·ºÅ丮¿¡¼. 2) µÚ¿¡ ¿À´Â Åë¾î·ÐÀ» »ç¿ëÇϽʽÿÀ:
mysqldump - u [»ç¿ëÀÚ À̸§] - p [¾ÏÈ£] - opt [µ¥ÀÌŸº£À̽º À̸§] > /root/backup/DATABASE1.sql
º¸±â´Â ¿©±â¿¡¼ ÀÖ´Ù backup.sh ´ç½ÅÀº 2°³ÀÇ µ¥ÀÌŸº£À̽º°¡ ÀÖ´ø °æ¿ì¿¡ ½ÅûÇϽʽÿÀ:
mysqldump -uUser1 -pPassword1 --opt Database1 > /root/backup/Database1.sql mysqldump -uUser2 -pPassword2 --opt Database2 > /root/backup/Database2.sql tar cvf /root/backup/sqlbackup.tar /root/backup/*
You can test your script by typing this:
sh backup.sh
(The mysqldump will overwrite the older file if you run this more than once)
3) If everything is working good, now you can put that script to be run once a day in your cron job.
For Fedora Core, you can edit this file /etc/cron.d/sa-update
Add the following line:
10 3 * * * root sh /root/backup/backup.sh
This will execute the script once a day at 3:10AM.
Now simply download one tar ball file whenever you feel like backing up your database.
You can probably change this a little bit and use it for many other things like backing up all your files too. (which I do)
If you have multiple servers like me, you can also automate your scripts to download backup databases to each server. That keeps things real redundant in case of server failure.


























