1001 1045.2 V1P1 n 1 We a Standby

Một phần của tài liệu Tìm hiểu hệ thống máy chủ cân bằng tải.PDF (Trang 51)

VIrt- 141 10021 AS.. Gatnrin *Isla 10 10 2 VW's. 1 41.10.0.20 4rftny VW? - 141.1011121 Standby Garay WI -.10 10 10 1

Chuang 4: Thiet kt mang veri hi) can bin tai Do VAn Thinh — A13439

ca cac get tin tra lati se thong qua cimg. mot default gateway vi dieu nay , gay ra luting luu lucmg bat doi ximg. Do 46, each tot nhat la sir dung DSR hoac NAT nguon khi ket not cac may chit den nhieu be can bang tai sir dung hai hay nhieu interface card mang trong may chit, trir khi chung ta hieu chinh xac hg dieu Wirth va hoat dung dm card mang.

%UP J 1-141.1Mf03 VRRP Q2-141 100 4

WM It 10 10.101020 141.10.141,1 tt 10. IRO 14AC•115 MAC 412 MAC • 5111 MAC

101 R52 103 RS4

Hinh 4.16: Tinh sin sang cao #9

Khi mot card mang gap phai stir co, bo can bang tai s6 xem xet may chit thvc ducm xitc dinh ved dia chi IP tren card mang do, sau 46 may chi, thine tiep tvc hoat dOng thong qua card mpg thin hai. Nhin chung, interface card mang trong the dO active-active ce the gay ra cac van de nhu da d'e cap.

43.7. Si giao tiep gifra cac bq can bang tai

Cho dit cluing ta sir dung the de hoot dOng active-standby so

active-active, cac be can bang tai van se giao tiep ved nhau bang each sir dung met so giao thine.

Khi sir dung cau hinh active-standby, cac be can bang tai can xic dinh .b0 can bang tai lam viec the d¢ hoat dOng va the dO du phOng. Thy thueic vao sin pham can bang tai, dieu nay c6 the, van de nay c6 the la met eau hinh bang tay frac tlr dOng. gifta hai bo can bang tai. Trong the dO cau hinh active-active, min bi) can bang taiphai xac dinh cac dja chi VIP hoat dOng va cac dja chi VIP dy phong tren mot be can bang tai. MOt each tiep can phirc tap hon se duqc xem xet khi be can bang tai ce duqc sv phuc vv tot tin met dja chi VIP dtra vao nang lye sin co tren mid bo can bang tai.

Chuang 4: Thiet ke mpg voi 1)(1 can bing tai DO Van Thjnh — A13439 Dieu quan tong la hai

tiep

can bang tai hoat dOng trong ciu hinh co tinh san sang cao co mot con duemg giao tiep clang tin coy giffa chimg. Twc tiep ket not hai NO can bang tai ding nhau th8ng qua mot idiom trunk cita hai hoOc nhieu lien ket de dam bao thong tin lien 1pc dang tin 0y, trir khi chimg to dang d8i phe veri mot thiet ke da duot trinh bay trong hinh 4.13. Nhin chung, mOt san pham can bang tai tot nen sir dung tat ea cac ,dtrang dan co san de giao tiep sled mot1)0 can bang tai !chic neu tat ca cac ket truc tiep gitta hai l%) can bang tai gap phai str co vi mOt ly do nao do.

Chacmg 5: ciu hinh cal dat vi thir nahiem

CHU'ONG 5: CAU HINH CAI HAT VA THU' NGHItM

5.1. Gifri &Fitt

DO VAn Thinh - A13439

HAProxy la phin mem mien phi, cung cep cac giii phap mang tinh sin sang cao. HAProxy rat nhanh va tin cjy cho cac Ung dung TCP/IP, dec biet la HTTP. No

thich kip cho cac trang web hog Ong tai cao, hog dOng yeti hang chuc ngin ket

• Giai phap HAProxy giai quyet ducyc cac nhu au hien nay nhu: can bing tai cho cac trang web hog dOng tai cao, dam bao cho djch vv web hog dOng lien tvc ngay ca khi c6 cac sv c8 ye logical hay vet 19 xay ra.

MO kink HAProxy

5.2. TOng quan HAProxy

lsibt fang itã try

HAProxy duce hi) try ten cac nen tang he dieu hinh nhu: Linux 2.4 on x86, x86_64, Alpha, SPARC, MIPS, PARISC Linux 2.6 on x86, x86_64, ARM (ixp425), PPC64

Chuang 5: cau hinh cal dat vi thin nghiem DO Van Thinh — A13439 Solaris 10 on Opteron and U1traSPARC

FreeBSD 4.10 - 6.2 on x86

OpenBSD 3.1 to -current on 1386, amd64, macppc, alpha ...

Char nang

• Dinh tuyen cac yeu cau HTTP (Kra ten cac cookies chi duqc chi dinh sin;

• Can bang tai de dam bio cac may chit host dOng lien tpc bang cach su dung HTTP cookies

• Chuyen d8i sang may cho du phong ngay khi may chn chinh gap su co

• Chap nhan cacket not den cac ding chi dinh sin phuc v4 cho viec theo dOi

iru diem

• Cung cap cac giai phap can bang tai, proxy nhanh vi tin cay • Nang cao tinh bao mat cim he thong

• Nang cao hieu nang vi tinh an than cfut 4 th8ng nhei chirc Jiang can bang tai vi sao luu du phong.

Khuyit diem

• Lam tang chi phi khi trien khai he th8ng

• He th8ng phIrc tap ham nen se kho khan trong viec van hanh va bao tri

5.3. Chi dot giiii phi!) HAProxy cho may chi' Web teen CentOS 5.3.1. Thiet Ice h? thOng 5.3.1. Thiet Ice h? thOng

Chuang 5: cau hinh cai dat va thir nghiem DO Van Thinh — A13439

HAProxy co dia chi 192.168.10.10

May chit 1 chay WebServer 1 va Database c6 dja chi IP 192.168.10.11 May chit 2 chay WebServer 2 NIA Database c6 dja chi IP 192.168.10.12

HAproxy, may chit 1 Nth may chit 2 ding sir dung mOt dia chi IP a° la 192.168.10.15

5.3.2. Hoot Ong

Khi may lchach c6 nhu au ket n6i toi may chit Web, se kat n6i vao dia chi 192.168.10.15 . Khi d6 ket not se tr6 tai HAProxy. Sau d6 HAproxy se Olen tai ye may chit 1 vi may chit 2

Neu may chit 1 hoac may chit 2 gap phai sr co thi HAProxy se tr6 kat not ye may chit con lai

Neu HAProxy gap phai van de thi kat not dm may khich den dia chi 192.168.10.15 se tr6 truc tiep den mOt trong 2 may chit 1 vi may chit 2

5.4. Chi city au hinh

5.4.1. Chi '1St au hinh HAProxy

Download haproxy # yum -y install haproxy

Xem phial.' bin cai dat haproxy # rpm -qa I grep haproxy

du nth HAproxy # vim /etc/haproxy/haproxy.cfg default listen webfann 192.168.10.10:80 mode hap stats enable

stats auth admin:admin stats uri /haproxy-status stats refresh lOs

stats hide-version balance roundrobin

cookie JSESSIONID prefix option httpclose

option forwardfor

option httpchk HEAD /check.txt HTTP/1.0

server webl 192.168.10.11:80 cookie A weight 70 check server web2 192.168.10.12:80 cookie B weight 30 check

DO Van Thinh — A13439

thinhdy'l server: home thinhdv _ 7 X

pie Edit ylew imTNInal Tabs yelp

maxconn 68089 retries 3

listen webfarm 192.168.10.10:88 mode http

stats enable

stats auth admin:admin stats uri /haproxy-status stats refresh 10s

stats hide-version balance roundrobin

cookie SERVERID insert indirect cookie ISESSIONID prefix

option httpclose option forwardfor

option httpchk HEAD /check.txt HTTP/1.0

server webl 192.168.10.11:80 cookie A weight 70 check server web2 192.168.10.12:80 cookie 8 weight 36 check

Một phần của tài liệu Tìm hiểu hệ thống máy chủ cân bằng tải.PDF (Trang 51)

Tải bản đầy đủ (PDF)

(66 trang)