1 / 22

2013. 01. 17 Austin

Linux LVS Tutorial. 2013. 01. 17 Austin. 목차. LVS ? LVS Framework Building SNS using LVS 구축 샘플 . 1. LVS?. LVS 는 Linux Virtual Server ( 가상 서버 ) 의 약자로서 , 리눅스 서버를 통하여 구성된 고성능 고가용성의 부하 분산 시스템을 말합니다 . 하지만 요즘엔 부하분산시스템 전체를 뜻하는 말로 통용되고 있습니다 .

kapila
Télécharger la présentation

2013. 01. 17 Austin

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux LVS Tutorial 2013. 01. 17 Austin

  2. 목차 LVS ? LVS Framework Building SNS using LVS 구축 샘플

  3. 1. LVS? LVS는 Linux Virtual Server (가상 서버)의 약자로서, 리눅스 서버를 통하여 구성된 고성능 고가용성의 부하 분산 시스템을 말합니다. 하지만 요즘엔 부하분산시스템 전체를 뜻하는 말로 통용되고 있습니다. 가상 서버는 실제 서버를 클러스터로 구성하여 뛰어난 확장성과 가용성을 구현한 서비스입니다. 사용자에게는 서버가 한대만 있는 것으로 인식되지만, 실제로는 여러대의 컴퓨터가 서비스를 수행하도록 구성된 것을 말합니다. 클러스터의 구조는 최종 사용자에게는 투명하며 사용자는 오직 하나의 가상 서버만을 볼 수 있습니다.

  4. 2. LVS Framework

  5. 2. LVS Framework • Implemented in the Linux Kernel • 3가지 IP load balancing 방식을 제공 • Virtual Server via NAT • Virtual Server via IP Tunneling • Virtual Server via Direct Routing • 8가지 Schedule Algorithms 제공

  6. 2. LVS Framework • LVS / NAT

  7. 2. LVS Framework • LVS / TURN

  8. 2. LVS Framework • LVS / DR

  9. 2. LVS Framework • 비교 Note : Load balancer 와 백엔드 서버가 동일한 하드웨어 구성을 가지고 있다는 가정을 기반으로 계측 된 것입니다.

  10. 2. LVS Framework • Scheduling Algorithms • Round – Robin • Weighted Round-Robin • Least-Connection • Weighted Least-Connection • Locality-Based Least-Connection • Locality-Based Least-Connection With Replication • Source Hashing • Destination Hashing

  11. 2. LVS Framework • Cluster Monitoring software • Red Hat Cluster Server / Piranha • LVS + Piranha • UltraMonkey • LVS + lvs-gui + heartbeat + ldirectord • Keepalived • Netparse • etc.

  12. 3. Building SNS using LVS • General Architecture • 3Tiers • Load balancer • Server Cluster • Shared Storage

  13. 3. Building SNS using LVS • Web Cluster

  14. 3. Building SNS using LVS • Cache Cluster

  15. 3. Building SNS using LVS • Mail Cluster

  16. 4. 구축 방법 • Requirement • Linux kernel 2.6 이상 • ( 이하 버전은 첨부 링크 참고 • http://www.linuxvirtualserver.org/software/ipvs.html ) • ipvsadm software • ( yum 으로 인스톨 ) • arptables_jf • ( yum 으로 인스톨) • 접근 가능한 가상아이피

  17. 4. 구축 방법 • Setting Figure • Load Balancer • Real IP : 211.1.1.10 • Virtual IP : 211.1.1.11 • Real Server • Real IP 211.1.1.20~N

  18. 4. 구축 방법 • Setting Command ( IPVS 서버 설정 ) • Load Balancer(이하 LB) 서버로 접속 • ipvsadm 설치 ( yum 으로 인스톨 ) • ifcfg-eth0:1 파일 생성 • > vi ifcfg-eth0:1 • DEVICE=eth0:1 • ONBOOT=yes • IPADDR=211.1.1.11 • BOOTPROTO=none • NETMASK=255.255.255.224 • TYPE=Ethernet • 파일 저장 • 네트웍 다시 시작 • >service network restart • 패킷 포워딩 설정 • > echo 1 > /proc/sys/net/ipv4/ip_forward

  19. 4. 구축 방법 • Setting Command ( IPVS 서버 설정 ) 서비스 서버로 라우팅 설정 > ipvsadm –A –t 211.1.1.11:80 –s rr > ipvsadm –a –t 211.1.1.11:80 –r 211.1.1.20:80 –g > ipvsadm –a –t 211.1.1.11:80 –r 211.1.1.21:80 –g > ipvsadm –a –t 211.1.1.11:80 –r 211.1.1.N:80 –g ipvsadm 설정 저장 > service ipvsadm save 설정파일은 /etc/sysconfig/ipvsadm경로에 저장됨 이후 설정은 설정파일을 에디팅 후 > service ipvsadm reload ( 설정파일의 값으로 ipvs설정 변경 )

  20. 4. 구축 방법 • Setting Command ( Real 서버 설정 ) • arptables_jf설치 • > yum install arptables_jf • arptables설정 • > arptables -A IN -d 211.1.1.11 -j DROP • > arptables -A OUT -d 211.1.1.11 -j mangle --mangle-ip-s 211.1.1.20 • arp설정 변경 • > echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore • > echo 2 > /proc/sys/net/ipv4/conf/lo/arp_announce • > echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore • > echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce • 서비스 서버에 lo 설정 • > vi lo:0 • DEVICE=lo:0 • IPADDR=211.1.1.11 • NETMASK=255.255.255.255

  21. 4. 구축 방법 • Setting Command ( Real 서버 설정 ) 라우팅 설정 > route add –host 211.1.1.11 dev lo:0 ARP 응답문제 해결 방법 loopback devices에서 Alias된 VIP가 추가된 경우 로컬네트워크의 ARP 요청이 로드밸런서로 가지 않고 리얼 서버가 먼저 응답하므로 부하분산이 되지 않는 문제가 생길 수 있다. 커널2.2.14 – Hidden Device 기능을 이용 커널2.4.X - Hidden patch 필요 커널2.6.X - /etc/sysctl.conf파일에 수정 후 활성화 # ARP hidden configure net.ipv4.conf.lo.arp_ignore = 1 net.ipv4.conf.lo.arp_announce = 2 net.ipv4.conf.all.arp_ignore = 1 net.ipv4.conf.all.arp_announce = 2 활성화 # sysctl -p TIP) 확인법으론windows나 linux에서 arp -a 명령을 실행. 로드밸런서 서버 맥어드레스가 나오면 정상적으로 셋팅이 된 것이다.

  22. 5. Reference http://www.linuxvirtualserver.org/software/index.html

More Related