Âü°í :
http://coffeenix.net/board_view.php?bd_code=1696
http://code.google.com/p/lsyncd/
µ¿±âÈ¿¡ ¶Ç´Ù¸¥ ¹æ¹ýÀÌ ÀÖ¾î¼ ¾Ë·Áµå¸³´Ï´Ù.
ÁÁÀºÁøÈ£´Ô¿¡ ±Û¿¡ °³ÀÎÀûÀ¸·Î Å×½ºÆ®ÇÏ¸é¼ ÇØ´ç³»¿ªÀ» Ãß°¡Çؼ Àû½À´Ï´Ù.
Lsyncd vs. DRBD
DRBD ºí·Ï ÀåÄ¡ ¼öÁØ¿¡¼ µ¿ÀÛÇÏ¸ç ½ºÅ丮ÁöÇüÅÂÀÇ Å«ÆÄÀÏ ½Ã½ºÅÛÀ» µ¿±âÈÇÒ°æ¿ì¿¡´Â À¯¿ëÇÕ´Ï´Ù. ÇÏÁö¸¸ ¹é¾÷µÇ´Â »óȲ¸¸ º¼¼ö ÀÖÀ¸¸ç ½ÇÁ¦ ¹é¾÷ µ¥ÀÌŸ¸¦ È®ÀÎÇÏÁö´Â ¸øÇѴٴ°Í... ¼Óµµ¼º¸é¿¡¼ ºü¸£³ª ºí·Ï´ÜÀ§ ¹é¾÷ÀÌ¶ó ¾µ¸ð¾ø´Â°Í±îÁö ¸ðÁ¶¸® ¹é¾÷µÇ±âµµ ÇÏ´ÂÁ¡ÀÌ ÀÖ½À´Ï´Ù.
ÇÏÁö¸¸ Lsyncd ´Â ÀåÄ¡ º¯°æ ¹× ÁöÁ¡À» ÇÊ¿ä·ÎÇÏÁö ¾Ê½À´Ï´Ù.
´õ±º´Ù³ª rsyncÀÇ ´ÜÁ¡ÀΠƯÁ¤½ºÄÉÁÙ¿¡ ÀÇÇؼ µ¿±âÈ µÇ±â¶§¹®¿¡ ¿ÏÀüÇÑ ¹Ì·¯¸µ ½Ã½ºÅÛÀ¸·Î´Â ºÎÁ·ÇÑÁ¡ÀÌ ÀÖ´Ù.
À̺κп¡ ´ëÇؼ rsync ±â´É¿¡ Ãß°¡Çؼ ½Ç½Ã°£ ¹Ì·¯¸µ ½Ã½ºÅÛÀ¸·Î ±¸ÃàÇÒ¼ö ÀÖ´Â ¹æ¹ýÀÌ ÀÖ¾î¼ ¼Ò°³µå¸³´Ï´Ù.
1. lsyncd µ¿±âÈ Åø
1) lsyncdÀÇ ¿ø¸®´Â °£´ÜÇÏ´Ù.
- ¸®´ª½º Ä¿³ÎÀÇ inotify·Î ÆÄÀϽýºÅÛÀÇ º¯°æ»çÇ×À» üũÇÑ´Ù. (ÆÇ´ÜÀº inotify·Î)
- º¯°æ»çÇ×ÀÌ »ý±âÀÚ¸¶ÀÚ, rsync¸¦ È£ÃâÇÏ¿© »ó´ë ¼¹ö·Î ½ÌÅ©¸¦ ÇØÁØ´Ù. (µ¿±âÈ´Â rsync·Î)
inotify´Â ¸®´ª½º Ä¿³Î¿¡ Æ÷ÇÔµÈ ±â´ÉÀ¸·Î, ÆÄÀϽýºÅÛ¿¡ º¯°æ»çÇ×ÀÌ ¹ß»ýÇÒ ¶§ À̺¥Æ®¸¦ Å뺸ÇØÁØ´Ù. ÀÌ inotify¸¦ ÀÌ¿ëÇÏ°Ô µÇ¸é, ÆÄÀÏ º¯°æ»çÇ×À» ¼ö½Ã·Î ÆľÇÇÒ ÇÊ¿ä¾øÀÌ °¡¸¸È÷ ¾É¾ÆÀÖÀ¸¸é µÈ´Ù. ÆÄÀÏÀÌ ¹Ù²ð ¶§ Ä¿³Î¿¡¼ Å뺸ÇØÁÖ´Â ½ÅÈ£¸¦ ´þ¼® ¹Þ¾Æ¸ÔÀ¸¸é µÇ±â ¶§¹®ÀÌ´Ù.
0.5ÃÊ(0.5ÃÊ´Â ±×¸¸Å ª´Ù´Â °ÍÀ» Ç¥ÇöÇϱâ À§Çؼ »ç¿ëÇßÀ½)µµ ¾ÈµÇ´Â ¾ÆÁÖ ÂªÀº ½Ã°£ µ¿¾ÈÀÇ Â÷ÀÌ´Â »ý±æ ¼ö ÀÖÁö¸¸, ¼Ò±Ô¸ð ¼¹ö¸¦ ¿î¿µÇÒ °æ¿ì¿¡´Â ¹«¸®°¡ ¾øÀ» °ÍÀ¸·Î º¸ÀδÙ.
- ¿øº» µ¥ÀÌÅÍ°¡ ÀÖ´Â ¼¹ö(1´ëÀÇ ¼¹ö)¿¡´Â lsyncd µ¥¸ó(lsyncd µ¥¸ó + rsync Ŭ¶óÀ̾ðÆ®)ÀÌ µ¿ÀÛÇÏ°Ô µÇ°í,
- µ¿±âÈ ´ë»ó ¼¹ö(´Ù¼öÀÇ ¼¹ö)¿¡´Â rsync µ¥¸ó(rsync ¼¹ö)ÀÌ ¶ç¿öÁ® ÀÖ¾î¾ß ÇÑ´Ù.
3) lsyncd master¼¹ö¿¡¼ ÇÊ¿ä ȯ°æÀº ´ÙÀ½°ú °°´Ù. ´ë»ó ¼¹ö´Â rsync¸¸ µ¿ÀÛÇϸé OSÁ¾·ù, ¹öÀü¿¡ »ó°ü¾ø´Ù.
- Linux Kernel 2.6.13 ÀÌ»ó (inotify¸¦ À§ÇØ)
- rsync ÇÁ·Î±×·¥
- lsyncd ÄÄÆÄÀÏÀ» À§Çؼ libxml2°¡ ÇÊ¿äÇÏ´Ù.
CentOS : libxml2-devel ÆÐÅ°Áö
Ubuntu : libxml2-dev ÆÐÅ°Áö
4) ¾î¶² °æ¿ì À¯¿ëÇÒ±î?
- ¼Ò±Ô¸ð »çÀÌÆ®¿¡¼ NFS´ë½ÅÇÏ¿© µ¿±âȸ¦ °í¹ÎÇÒ ¶§. (´Ü, ÆÄÀÏÀÌ ³Ê¹« ¸¹À¸¸é µ¿±âÈ°¡ ´Ê¾îÁú ¼ö ÀÖÀ½)
- ½Ç½Ã°£ ¹é¾÷ÀÌ ÇÊ¿äÇÒ ¶§.
-
´ë±Ô¸ð À¥»çÀÌÆ®¿¡¼ ¸ÞÀÎÆäÀÌÁö³ª ´ë¸Þ´ºÀÇ Ã¹ÆäÀÌÁö µî À¯Àú Á¢¼ÓÀÌ ¸¹´Ù.
ÀÌ ÆäÀÌÁö¿¡¼ ½Ç½Ã°£À¸·Î º¯°æµÇ´Â µ¥ÀÌÅ͸¦ ¸Å¹ø DBÁ¢¼ÓÇÏ¿© ó¸®ÇÏ´Â °ÍÀº ÁÁÁö ¾Ê´Ù.
½Ç½Ã°£ µ¥ÀÌÅ͸¦ 1ºÐ ¶Ç´Â ´õ ªÀº °£°ÝÀ¸·Î ÅؽºÆ®·Î ÀúÀåÇÏ°í, º¯°æÀÌ µÇÀÚ¸¶ÀÚ ÀÚµ¿ µ¿±âÈ µÇµµ·Ï ó¸®ÇÒ ¶§.
±Ô¸ð°¡ Å©¸é 1Â÷ master -> 2Â÷ ¿©·¯´ëÀÇ master -> »ó´ç¼öÀÇ ¼ºñ½º ¼¹öÀÇ ±¸Á¶°¡ µÉ ¼öµµ ÀÖ´Ù.
¼³Ä¡
- http://code.google.com/p/lsyncd/downloads/list
2. lsyncd¸¦ ÀÌ¿ëÇÑ ½Ç½Ã°£ µ¿±âÈ
±âº» Çü½ÄÀº ´ÙÀ½°ú °°´Ù.
USAGE: lsyncd [OPTION]... [SOURCE] [TARGET 1] [TARGET 2] ...
SOURCE: a directory to watch and rsync.
TARGET: can be any name accepted by rsync. e.g. "foohost::barmodule/"
´ÙÀ½Àº °£´ÜÇÑ »ç¿ë ¿¹ÀÌ´Ù. lsyncdÀº rsync¸¦ »ç¿ëÇÏ¿© µ¿±âÈÇϹǷÎ, TARGETÀº rsyncó·³ ·ÎÄà µð·ºÅ丮¸¦ ÁöÁ¤ÇÒ ¼öµµ ÀÖÀ¸¸ç, ¿ø°ÝÁöÀÇ rsync °æ·Îµµ °¡´ÉÇÏ´Ù. TARGETÀ» ´Ù¼ö ÁöÁ¤ÇÏ°Ô µÇ¸é ¿©·¯ ¼¹ö·Î ½Ç½Ã°£ µ¿±âÈ°¡ ÀÌ·ïÁø´Ù.
[root@node1 lsyncd-1.26]# ./lsyncd /home/aaa/ /data/backup/
[root@node1 lsyncd-1.26]# ./lsyncd /home/aaa/ 192.168.123.3::test1/
[root@node1 lsyncd-1.26]# ./lsyncd /home/aaa/ 192.168.123.3::test1/ 192.168.123.4::test1/
Å×½ºÆ®)
µ¿±âÈÇÒ ¼¹ö¿¡´Â rsync ¼³Á¤°ú µ¿ÀÏÇÏ°Ô /etc/rsyncd.conf ¼³Á¤À»...
[test1]
path =/home/aaa
comment =
uid = root
gid = root
use chroot = yes
read only = no
hosts allow = 218.236.115.225
max connections = 5
timeout = 600
Master ¼¹ö¿¡¼ lsyncd µ¥¸óÀ»....¿Ã¸®°í
[root@node1 lsyncd-1.26]# /usr/local/src/lsyncd-1.26/lsyncd /home/aaa 218.236.115.226::test1
[root@node1 lsyncd-1.26]# ps -aux
root 15226 0.0 0.0 13884 488 ? Ss 12:31 0:00 /usr/local/src/lsyncd-1.26/lsyncd /home/aaa 218.236.115.226::test1
µÎ°³ÀÇ ¼¹ö¿¡¼ µ¿±âȵǴ °úÁ¤À» FTP ¸¦ ÅëÇØ ÆÄÀÏÀ» °è¼ÓÇؼ ¿Ã¸®¸é¼ È®ÀÎÇغ¸¸é...½Ç½Ã°£À¸·Î ¹Ù·Î µ¿±âÈ°¡ µÇ°íÀÖÀ½ÀÌ È®ÀεȴÙ.
lsyncd´Â ±âº»ÀûÀ¸·Î daemonÇüÅ·Π½ÇÇàµÇ¸ç, /var/log/lsyncd ÆÄÀÏ¿¡ ·Î±×°¡ ÀúÀåµÈ´Ù. ´ÙÀ½Àº Å×½ºÆ®¸¦ À§Çؼ --no-daemon¿É¼ÇÀ» ³Ö°í ½ÇÇàÇß´Ù. ·Î±×¸¦ »ìÆ캸¸é ´ÙÀ½°ú °°Àº »çÇ×À» ÆľÇÇÒ ¼ö ÀÖ´Ù.
- ¾îµð¿¡¼ ¾îµð·Î µ¿±âÈ°¡ µÇ´ÂÁö È®ÀÎÇÒ ¼ö ÀÖ´Ù. ( syncing /home/aaa/ -> 192.168.123.3::test1/ )
- 16°³ µð·ºÅ丮( /home/aaa/ + 15°³ÀÇ ¼ºêµð·ºÅ丮 )¸¦ ¸ð´ÏÅ͸µÇÑ´Ù. ( [16] monitored directories )
- truefeel.txt ÆÄÀÏÀÌ »ý¼ºµÇÀÚ¸¶ÀÚ rsync¸¦ È£ÃâÇÏ¿© µ¿±âȵȴÙ.
- ¼ºê µð·ºÅ丮( /home/aaa/docs/ ) ³»ÀÇ ÆÄÀÏÀÌ º¯°æµÈ °æ¿ì ±× µð·ºÅ丮¸¸ µ¿±âÈÇÑ´Ù. ( rsyncing /home/aaa/docs/ --> 192.168.123.3::test1/docs/ ) Àüü µð·ºÅ丮¸¦ µ¿±âÈÇÏÁö ¾Ê±â ¶§¹®¿¡ ±× ¸¸Å µ¿±âÈ ½Ã°£ÀÌ »¡¶óÁø´Ù.
|
# ./lsyncd --no-daemon /home/cnx/ 192.168.123.3::backup/ Fri Dec 4 18:13:13 2009: command line options: syncing /home/cnx/ -> 192.168.123.3::backup/
Fri Dec 4 18:13:13 2009: Starting up Fri Dec 4 18:13:13 2009: watching /home/cnx/ Fri Dec 4 18:13:13 2009: found new directory: ?????? in /home/cnx/ -- added on tosync stack. Fri Dec 4 18:13:13 2009: found new directory: ?????? in /home/cnx/ -- added on tosync stack. ... »ý·« ... Fri Dec 4 18:13:13 2009: --- Entering normal operation with [16] monitored directories --- Fri Dec 4 18:14:40 2009: event CREATE:truefeel.txt triggered. Fri Dec 4 18:14:40 2009: rsyncing /home/cnx/ --> 192.168.123.3::backup/ Fri Dec 4 18:14:40 2009: event CLOSE_WRITE:truefeel.txt triggered. Fri Dec 4 18:14:40 2009: rsyncing /home/cnx/ --> 192.168.123.3::backup/ Fri Dec 4 18:16:22 2009: event CREATE:vimcheatsheet.pdf triggered. Fri Dec 4 18:16:22 2009: rsyncing /home/cnx/docs/ --> 192.168.123.3::backup/docs/ Fri Dec 4 18:16:22 2009: event CLOSE_WRITE:vimcheatsheet.pdf triggered. Fri Dec 4 18:16:22 2009: rsyncing /home/cnx/docs/ --> 192.168.123.3::backup/docs/
|
|
´ÙÀ½Àº TARGETÀ» 2°÷À¸·Î ÁöÁ¤ÇßÀ» ¶§ µ¿±âÈ °á°úÀÌ´Ù.
|
Fri Dec 4 19:04:37 2009: event CREATE:cnx.txt triggered. Fri Dec 4 19:04:37 2009: rsyncing /home/cnx/ --> 192.168.123.3::backup/ Fri Dec 4 19:04:37 2009: rsyncing /home/cnx/ --> 192.168.123.4::backup/ Fri Dec 4 19:04:37 2009: event CLOSE_WRITE:cnx.txt triggered. Fri Dec 4 19:04:37 2009: rsyncing /home/cnx/ --> 192.168.123.3::backup/ Fri Dec 4 19:04:37 2009: rsyncing /home/cnx/ --> 192.168.123.4::backup/
|
|
3. lsyncd config ÆÄÀÏ
lsyncd.conf »ùÇà ¼³Á¤ ÆÄÀÏÀÌ´Ù.
|
<lsyncd version="1">
<settings> ¡¡¡¡¡¡<!--uncomment to log all debug messages.--> ¡¡¡¡¡¡<!--debug/--> ¡¡¡¡¡¡ ¡¡¡¡¡¡<!--uncomment to log only errors.--> ¡¡¡¡¡¡<!--scarce/--> ¡¡¡¡¡¡ ¡¡¡¡¡¡<!--uncomment to not detach, log to stdout/stderr.--> ¡¡¡¡¡¡<!--no-daemon/-->
¡¡¡¡¡¡<!--uncomment to not call any actions, run dry only.--> ¡¡¡¡¡¡<!--dryrun/-->
¡¡¡¡¡¡<!--uncomment to exclude file handled to rsync.--> ¡¡¡¡¡¡<!--exclude-from filename="/tmp/exclude"/-->
¡¡¡¡¡¡<logfile filename="/var/log/lsyncd"/> ¡¡¡¡¡¡<binary filename="/usr/bin/rsync"/> ¡¡¡¡¡¡<!--pidfile filename="/var/run/lsyncd.pid"/-->
¡¡¡¡¡¡<callopts> ¡¡¡¡¡¡¡¡¡¡¡¡<option text="-ltogp%r"/> ¡¡¡¡¡¡¡¡¡¡¡¡<option text="--delete"/> ¡¡¡¡¡¡¡¡¡¡¡¡<exclude-file/> ¡¡¡¡¡¡¡¡¡¡¡¡<source/> ¡¡¡¡¡¡¡¡¡¡¡¡<destination/> ¡¡¡¡¡¡</callopts> </settings>
<directory> <source path="/home/aaa/"/> <target path="218.236.115.226::test1/"/> </directory>
</lsyncd>
|
|
<settings> ÀÇ ¼³Á¤¿¡´Â ´ÙÀ½ Ç׸ñµéÀÌ ÀÖ´Ù.
- debug : debug mode·Î ½ÇÇàÇÑ´Ù. »ó¼¼ÇÑ ·Î±×°¡ ³²´Â´Ù. Àû¿ëÇÏ·Á¸é <debug/> ó·³ ¼³Á¤ÇÑ´Ù.
- scarce : debug¿Í´Â ¹Ý´ëµÇ´Â °³³ä. ¿¡·¯¸¸ ·Î±×¿¡ ³²±ä´Ù.
- no-daemon : µ¥¸óÇüÅ·Π½ÇÇàÇÏÁö ¾ÊÀ¸¸ç, ·Î±×´Â ȸ鿡 ¹Ù·Î Ãâ·ÂµÈ´Ù.
- dryrun : ½ÇÁ¦ Àû¿ëÇÏÁö´Â ¾Ê´Â´Ù ¾î¶»°Ô µ¿ÀÛÇÏ´ÂÁö ·Î±×¿¡¸¸ ³²±â°í, µ¿±âÈ(rsync)´Â ½ÇÇàÇÏÁö ¾Ê´Â´Ù.
- exclude-from : Á¦¿ÜÇÒ ¸ñ·ÏÀÌ µé¾îÀÖ´Â ÆÄÀϸíÀ» ÁöÁ¤ÇÑ´Ù.
- logfile : ·Î±× ÆÄÀϸí
- binary : rsyncÀÇ °æ·Î
- pidfile : PID ÆÄÀϸí
- callopts : rsync È£ÃâÇÒ ¶§ »ç¿ëÇÒ ¿É¼ÇÀ» ÁöÁ¤ÇÑ´Ù.
<directory> Àº µû·Î ¼³¸íÇÏÁö ¾Ê¾Æµµ ¹Ù·Î ÀÌÇØ°¡ µÉ °ÍÀÌ´Ù. ´ë»ó ¼¹ö°¡ ¸¹À¸¸é ÂÞ¿í ³ª¿ÇØÁÖ¸é µÈ´Ù.
|
# ./lsyncd --conf lsyncd.conf
|
|
µû·Î ½ÃÀÛ/ÁßÁö ½ºÅ©¸³Æ®¸¦ ¸¸µé¾î¼ »ç¿ë...
#!/bin/bash
# description: lsyncd auto start script
start() {
pid=`pidof lsyncd`
if [ $? -eq 0 ]; then
echo "lsyncd (pid $pid) is running..."
echo " "
else
echo "Starting lsyncd..."
echo " "
/usr/local/bin/lsyncd
fi
}
stop() {
echo "Stopping lsyncd..."
echo " "
/bin/kill -9 `/sbin/pidof rsync`
until [ -z $(/sbin/pidof lsyncd) ]; do :; done
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
pid=`pidof lsyncd`
if [ $? -eq 0 ]; then
echo "lsyncd (pid $pid) is running..."
echo " "
else
echo "lsyncd is not running"
echo " "
fi
;;
*)
echo "Usage: lsyncd {start|stop|restart|status}"
exit 1
esac
exit $?
4. lsyncd ±íÀÌ ¾Ë±â1) ƯÁ¤ ¼ºê µð·ºÅ丮³ª ÆÄÀÏÀ» Á¦¿Ü(exclude)ÇÏ·Á¸é?lsyncd´Â µ¿±âÈ¿¡¼ Á¦¿ÜÇÒ µð·ºÅ丮 ¸ñ·ÏÀ» '--exclude-from FILE' ¿É¼ÇÀ¸·Î ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù. lsyncd_exclude.lst ÆÄÀÏ¿¡ ¾Æ·¡ ³»¿ëÀ» ³ÖÀ¸¸é 2°³ µð·ºÅ丮¸¦ Á¦¿ÜÇÏ°Ô µÈ´Ù. ƯÁ¤ ÆÄÀϸ¸ Á¦¿ÜÇÒ ¼ö´Â ¾ø´Ù. µð·ºÅ丮¸¸ ÁöÁ¤ÀÌ °¡´ÉÇÏ´Ù. Á¦¿ÜÇÑ µð·ºÅ丮´Â rsyncÇÒ ¶§ Á¦¿ÜµÇ´Â °ÍÀÌ ¾Æ´Ï¶ó, inotifyÀÇ ¸ð´ÏÅ͸µ ´ë»ó ÀÚü¿¡¼ ºüÁø´Ù. ºüÁø µð·ºÅ丮¼ö(¼ºêµð·ºÅ丮µµ ÀÖ´Ù¸é ±× °Íµµ Æ÷ÇÔ)¸¸Å 'Entering normal operation with [??] monitored directories' ·Î±×¿¡ ³²À¸´Ï, °è»êÇغ¸¸é È®ÀÎÀÌ µÉ °ÍÀÌ´Ù.
configÆÄÀÏ¿¡¼ ¼³Á¤ÇÏ·Á¸é ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.
|
<exclude-from filename="/etc/lsyncd_exclude.lst"/>
|
|
µð·ºÅ丮°¡ ¾Æ´Ñ ÆÄÀÏÀ» µ¿±âÈ ´ë»ó¿¡¼ Á¦¿ÜÇÏ·Á¸é ¾î¶»°Ô ÇؾßÇÒ±î? rsync ¿É¼ÇÀ» È°¿ëÇØ¾ß ÇÑ´Ù. rsyncÀÇ --exclude-from=FILE ¿É¼ÇÀÌ ÀÖ´Ù. ÆÄÀÏ(¿¹. lsyncd_file_exclude.lst) ¿¡ Á¦¿ÜÇÒ ÆÄÀϸñ·ÏÀ» ³Ö´Â´Ù. ±×¸®°í, config ÆÄÀÏÀÇ rsync¿É¼ÇºÎºÐ¿¡ ´ÙÀ½À» Ãß°¡ÇÏ¸é µÈ´Ù.
|
<option text="--exclude-from=/etc/lsyncd_file_exclude.lst"/>
|
|
ÆÄÀÏ Á¦¿ÜÇÒ ¶§ ÁÖÀÇÇÒ °ÍÀº ¼ºê µð·ºÅ丮¿¡ °°Àº ÆÄÀϸíÀÌ ÀÖÀ» ¶§µµ Á¦¿ÜµÉ ¼ö ÀÖ´Ù. ¸¸¾à lsyncd_file_exclude.lst¿¡ cnx.doc À» ÁöÁ¤Çß´Ù°í ÇÏÀÚ. ±×·¯³ª ¿ì¿¬Âú°Ô lib/cnx.doc ÆÄÀÏÀÌ ½ÇÁ¦ Á¸ÀçÇÒ ¶§ lib/cnx.doc ÆÄÀÏÀÌ º¯°æµÇ¾îµµ µ¿±âÈ ¾ÈµÉ ¼ö ÀÖ´Ù.
2) Æ۹̼Ç, ¼ÒÀ¯ÀÚ±îÁö º¯°æÇÏ·Á¸é?lsyncd´Â Æ۹̼ǰú ¼ÒÀ¯ÀÚÀÇ º¯°æÀº ¹«½ÃÇϵµ·Ï µÇ¾î ÀÖ´Ù. debug ¸ðµå·Î »ìÆ캸¸é ·Î±×¿¡ ´ÙÀ½°ú °°ÀÌ ³²´Â´Ù.
|
Fri Dec 4 19:13:18 2009: inotfy event: ATTRIB:cnx.txt Fri Dec 4 19:13:18 2009: ... ignored this event. Fri Dec 4 19:13:18 2009: Processing through tosync stack. Fri Dec 4 19:13:18 2009: being done with tosync stack
|
|
ÆÄÀÏ ¼Ó¼º º¯°æ±îÁö µ¿±âÈÇϱâ À§Çؼ´Â lsyncd.c ¼Ò½º ¼öÁ¤ÀÌ ÇÊ¿äÇÏ´Ù. 1131¹ø°ÁÙ¿¡¼ IN_ATTRIB¸¦ Ãß°¡ÇØÁÖ¸é ÆÄÀϼӼº º¯°æ½Ã µ¿±âȵȴÙ.
|
if ((IN_CREATE | IN_CLOSE_WRITE | IN_DELETE | IN_MOVED_TO | IN_MOVED_FROM | IN_ATTRIB ) & event->mask
|
|
±×¸®°í, configÆÄÀÏ¿¡¼ rsync ¿É¼Ç º¯°æÀÌ ÇÊ¿äÇÏ´Ù. <callopts> ¿¡¼ <option text="-lt%r"/> ´ë½Å <option text="-ltogp%r"/>·Î º¯°æÇÑ´Ù. o´Â ¼ÒÀ¯ÀÚ À¯Áö, g´Â ¼ÒÀ¯±×·ì À¯Áö, p´Â ÆÛ¹Ì¼Ç À¯Áö.
3) lsyncd°¡ rsync¸¦ ¾î¶»°Ô È£ÃâÇÏ´ÂÁö ±Ã±ÝÇÏ´Ù?lsyncd°¡ ½ÇÇàµÇ´Â ¼¹ö¿¡¼ ´ÙÀ½ ½ºÅ©¸³Æ®¸¦ ½ÇÇàÇÑ´Ù. ÆÄÀϺ¯°æ½Ã Áï½Ã ½ÇÇàµÇ´Â rsync ¸í·ÉÀ» È®ÀÎÇÒ ¼ö ÀÖ´Ù.
|
#!/bin/bash
while [ 1 ] do ¡¡¡¡¡¡date +'%H:%M:%S' ¡¡¡¡¡¡ps auxww|grep [r]sync ¡¡¡¡¡¡sleep 0.05 done
|
|
rsync°¡ È£ÃâµÇ´Â ¼ø°£¿¡ ´ÙÀ½°ú °°ÀÌ È¸é¿¡ Ãâ·ÂµÉ °ÍÀÌ´Ù.
|
19:19:46 19:19:46 root 4076 0.0 0.0 5812 1036 ? S 19:19 0:00 /usr/bin/rsync -ltogpd --delete /home/cnx/docs/ 192.168.123.3::backup/docs/
|
|
4) rsync ´ë½Å ´Ù¸¥ µ¿±âÈ ÇÁ·Î±×·¥ È£Ãâlsyncd´Â rsyncÀÇ °æ·Î¸¦ --binary ¿É¼ÇÀ̳ª config¿¡¼ ¼³Á¤ÇÒ ¼ö ÀÖ´Ù. µû¶ó¼ ÀÌ °æ·Î¸¦ ¼öÁ¤ÇÏ°Ô µÇ¸é rsync¸¦ Á÷Á¢ È£ÃâÇÏÁö ¾Ê°í, ½ºÅ©¸³Æ®¸¦ ÅëÇØ È£ÃâÇÒ ¼ö°¡ ÀÖ´Ù. ±×·¡¼ µ¿±âÈÇÒ ¶§ ¨ç ¿øÇÏ´Â ¸í·ÉÀ» ½ÇÇàÇÒ ¼öµµ ÀÖ°í, ¨é rsync ´ë½Å ´Ù¸¥ µ¿±âÈ ÇÁ·Î±×·¥µµ »ç¿ëÇÒ ¼ö°¡ ÀÖ°Ô µÈ´Ù.
ÀϺ» KLAB¿¡¼ ¸¸µç µ¿±âÈ ÅøÀÎ Makuosan(
http://lab.klab.org/wiki/Makuosan )ÀÌ ÀÖ´Ù. ÀÌ ÅøÀº µ¿±âÈ ¼¹ö°¡ 1´ëÀÌµç ¸î½Ê´ëÀÌµç ¼Óµµ ÀúÇϾøÀÌ °ÅÀÇ µ¿½Ã¿¡ µ¿±âȵȴÙ. ÀÌ ÅøÀ» ÀÌ¿ëÇÏ¿© ½ºÅ©¸³Æ®¸¦ ¸¸µç´Ù¸é Àç¹Õ´Â Á¶ÇÕ( lsyncd + Makuosan )ÀÌ µÉ °ÍÀÌ´Ù. ½Ç½Ã°£ ÆÄÀÏ º¯°æ ÆÇ´ÜÀº lsyncd·Î ÇÏ°í, µ¿±âÈ´Â ºü¸¥ Makuosan·Î ÀÌ·ïÁö´Â °ÍÀÌ´Ù.
Âü°í·Î rsync¸¦ ½ºÅ©¸³Æ®·Î ¸¸µç °æ¿ì´Â
http://code.google.com/p/lsyncd/wiki/HowToExecAfter ¸¦ Àо±â ¹Ù¶õ´Ù.
5. ÁÖÀÇÇÒ Á¡
- DB ÆÄÀÏ, log ÆÄÀÏó·³ ÆÄÀÏÀÌ °è¼Ó activeµÈ »óÅ·Πº¯°æµÇ´Â µð·ºÅ丮¿¡´Â »ç¿ëÇÏÁö ¾Ê´Â´Ù.
- ÆÄÀÏ º¯È°¡ »ó´çÈ÷ ÀæÀ» µð·ºÅ丮¿¡´Â »ç¿ëÇÏÁö ¾Ê´Â´Ù.
- ÇÑ °³ÀÇ µð·ºÅ丮 ³»¿¡ ÆÄÀÏÀÌ ³Ê¹« ¸¹À¸¸é µ¿±âÈ°¡ ´À·ÁÁú ¼ö ÀÖ´Ù.
- ÆÄÀÏÀÌ Å« ÆÄÀÏ(¸î ¹é¸Þ°¡ ¶Ç´Â ¸î ±â°¡)ÀÌ º¯°æµÉ °æ¿ì µ¿±âÈ°¡ ´À·ÁÁú ¼ö ÀÖ´Ù. ¶ÇÇÑ ÀÌ·¸°Ô Å« ÆÄÀÏÀÇ º¯°æÀÌ ÀæÀ¸¸é Á¦¿ÜÇØÁÖ´Â °ÍÀÌ ÁÁ´Ù.
- lsyncd°¡ ÆÄÀÏ º¯È¸¦ ¸ð´ÏÅ͸µÇÒ ¼ö ÀÖ´Â µð·ºÅ丮 °¹¼ö´Â ÃÖ´ë 8192°³ÀÌ´Ù.
Ä¿³Îº¯¼ö¸¦ ÀÌ¿ëÇؼ ¼öÁ¤°¡´ÉÇÏ´Ù.
±âº»¼³Á¤Àº 8192°³ À̳ª ¼öÁ¤ÇÏ¸é ´Ã¸±¼ö ÀÖ½À´Ï´Ù.
±×¸®°í ext2. ext3 ÆÄÀϽýºÅÛ¿¡¼´Â ±âº»ÀûÀ¸·Î µð·ºÅ丮°¡ 32000°³ ±îÁö ¸¸µé¾îÁý´Ï´Ù.
cat /proc/sys/fs/inotify/max_user_watches