¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 1,363°Ç
   
·Îµå¹ë·±½Ì(ipvsadm) + fwmark + ldirectord.cf
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2011-02-01 (È­) 10:37 Á¶È¸ : 12167
±ÛÁÖ¼Ò :
                                
iptable mangle Å×À̺í°ú forward fwmark ¸¦ ÀÌ¿ëÇؼ­ Dynamic ÇÑ Æ÷Æ®¸¦ ÀÌ¿ëÇÏ¿© ´ÙÁßÆ÷Æ®¿¡ ´ëÇؼ­ ¹ë·±½ÌÀ» ÇѴٰųª 80¹ø°ú 443°ú °°ÀÌ ÀüÀÚ»ó°Å·¡¿¡ ÀÎÁõ°ü·ÃÇؼ­ Ç×»ó ±×·ìÁö¾î¼­ ¿î¿µÇÏ¿©¾ßÇÒ¶§ »ç¿ëÇÏ´Â ¹æ½Ä¿¡ ´ëÇؼ­ ¼³¸íÇÏ°íÀÚ ÇÑ´Ù.
 
forward fwmakr (¹æÈ­º® Ç¥½Ã±â´É??)
¹æÈ­º® Ç¥½Ã ±â´ÉÀº ¿¬°üµÈ ÇÁ·ÎÅäÄÝÀÇ ÇÁ·ÎÅäÄÝÀ̳ª ±×·ì¿¡ »ç¿ëµÇ´Â °¡Àå ½±°í È¿°úÀûÀÎ ±×·ì Æ÷Æ® ¹æ¹ýÀÔ´Ï´Ù. ¿¹¸¦ µé¾î, LVS°¡ ÀüÀÚ »ó°Å·¡ »çÀÌÆ®¸¦ ½ÇÇàÇϵµ·Ï µÇ¾î ÀÖÀ» °æ¿ì, ¹æÈ­º® Ç¥½Ã ±â´ÉÀº Æ÷Æ® 80¿¡¼­ÀÇ HTTP ¿¬°á°ú Æ÷Æ® 443¿¡¼­ÀÇ HTTPS ¿¬°áÀ» ÀÏ°ýÀûÀ¸·Î ¹­¾î ó¸®Çϴµ¥ »ç¿ëµÉ ¼ö ÀÖ½À´Ï´Ù. °¢°¢ÀÇ ÇÁ·ÎÅäÄÝ¿¡ ´ëÇØ °¡»ó ¼­¹ö¿¡ µ¿ÀÏÇÑ ¹æÈ­º® Ç¥½Ã ±â´ÉÀ» ÁöÁ¤Çϸé Æ÷Æ®°¡ ¿¬°áµÈ ÈÄ LVS ¶ó¿ìÅÍ°¡ µ¿ÀÏÇÑ ½ÇÁ¦ ¼­¹ö¿¡ ¸ðµç ¿äûÀ» º¸³»±â ¶§¹®¿¡ Æ®·£Àè¼Ç¿¡ ´ëÇÑ »óÅ Á¤º¸¸¦ º¸È£ÇÒ ¼ö ÀÖ½À´Ï´Ù.
 
ÀÌ¿Í °°Àº È¿°úÀûÀÌ°í »ç¿ë °£ÆíÇÔ ¶§¹®¿¡ LVS °ü¸®ÀÚ´Â ±×·ì ¿¬°áÀ» ÇÒ ¶§ ¸¶´Ù Áö¼Ó¼º ±â´Éº¸´Ù ¹æÈ­º® Ç¥½Ã ±â´ÉÀ» »ç¿ëÇØ¾ß ÇÕ´Ï´Ù. ÇÏÁö¸¸, Ŭ¶óÀ̾ðÆ®°¡ ÀÏÁ¤ ±â°£ µ¿¾È µ¿ÀÏÇÑ °¡»ó ¼­¹ö·Î ´Ù½Ã ¿¬°áÇÏ°Ô Çϱâ À§ÇØ °¡»ó ¼­¹ö¿¡ ¹æÈ­º® ±â´É°ú ÇÔ²² Áö¼Ó¼º ±â´ÉÀ» Ãß°¡½Ãų ¼ö ÀÖ½À´Ï´Ù.
 
 
ƯÁ¤Æ÷Æ®¸¦ ¸®¾ó¼­¹ö Æ÷Æ®¿¡ 1:1 ¸ÅÇÎÁö¾î¼­ ¿î¿µÇÏ°Ô µÉ°æ¿ì ´ÜÁ¡
1. Active ÀûÀÎ Æ÷Æ®¿¡ ´ëÇؼ­ ÀÏÀÏÈ÷ ¼­ºñ½º¸¦ µî·ÏÀ» ÇØÁà¾ßÇÑ´Ù. 
2. 80Æ÷Æ®¿Í 443 Æ÷Æ®ÇÏ°í ±×·ìÈ­µÇ¾î¼­ ¿î¿µµÇ¾î¾ß Çϴ°æ¿ì
 
Every 2.0s: ipvsadm -ln                                                                            Tue Feb  1 11:11:36 2011
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  192.234.6.2:80 sh
  -> 192.234.6.8:80               Masq    1      0          0
  -> 192.234.6.7:80               Masq    1      0          0
TCP  192.234.6.2:443 sh
  -> 192.234.6.7:443              Masq    1      0          0
  -> 192.234.6.8:443              Masq    1      0          0
 
¡Ø ¸®¾ó¼­¹ö¸¦ º¸¸é VIP¿¡ ¹°·ÁÀÖ´Â ¼ø¼­°¡ ´Ù¸£´Ù.
ldirectord ¸ð´ÏÅ͸µ¿¡ µû¶ó¼­ ¼­ºñ½º·Î »õ·Î ¿Ã¶ó¿À°í »èÁ¦µÊ¿¡ µû¶ó¼­ ¸®¾ó¼­¹ö ¼ø¼­°¡ ¹Ù²î°Ô µÇ´Âµ¥ ¼¼¼ÇÀ» DBÈ­ÇÏÁö ¾ÊÀ»°æ¿ì¿¡´Â ÀÎÁõ¼­¹ö(443Æ÷Æ®)¿Í ¼­ºñ½º(80Æ÷Æ®)°¡  SH ½ºÄÉÁÙ¸µ¿¡ ÀÇÇØ °¢±â ´Ù¸¥ ¼­¹ö·Î Á¢¼ÓÇعö¸®¸é ÀÎÁõÀº 7¹ø¼­¹ö¿¡¼­ ÇÏ°í ½ÇÁ¦ ¼­ºñ½ºÇÏ´Â Æ®·¡ÇÈÀº 8¹ø ¼­¹ö¸¦ Á¢¼ÓÇÏ´Â ¹®Á¦·Î ÀÎÇØ ÀÎÁõÀÌ ¹Ù·Î Ç®¸®°Ô µÇ¹ö¸®´Â Çö»óÀÌ ¹ß»ýµÈ´Ù.
ÀÌ·²°æ¿ì ¸®¾ó¼­¹ö¸¦ ±×·ìÈ­Çؼ­ »ç¿ëÇØ¾ß ÇÑ´Ù.
 
 
# VIP ·Î µé¾î¿À´Â 80,443 Æ÷Æ®¿¡ ´ëÇؼ­ MARK 1
[root@localhost ~]# iptables -t mangle -A PREROUTING -i br0 -p tcp -d 192.234.6.2 -m multiport --dport 80,443 -j MARK --set-mark 1
 
# MARK1 À¸·Î º¸³»Áö´Â Æ®·¡ÇÈÀº ¸®¾ó¼­¹ö·Î ºÐ»ê
[root@localhost ~]# ipvsadm -A -f 1 -s sh
[root@localhost ~]# ipvsadm -a -f 1 -r 192.234.6.7
[root@localhost ~]# ipvsadm -a -f 1 -r 192.234.6.8
 
 
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
FWM  1 sh
  -> 192.234.6.7:0                Masq    1      2          0
  -> 192.234.6.8:0                Masq    1      0          0
 
 
¿©±â¿¡ ldirectord ¸¦ ÀÌ¿ëÇؼ­ ¸®¾ó¼­¹ö ¸ð´ÏÅ͸µ ºÎºÐÀ» Ãß°¡Çϸé...
[root@localhost ~]# cat > ldirectord.cf
checktimeout=3
checkinterval=3
autoreload=yes
logfile="/var/log/ldirectord.log"
quiescent=no
 
virtual=1
    scheduler=sh
    checktype=connect
    protocol=fwm
    checkport=80
    real=192.234.6.7 masq
    real=192.234.6.8 masq

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.