Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 66 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
66
Dung lượng
0,93 MB
Nội dung
Chuang 1: GU% thieu DO Van Minh - A13439 CHUONG 1: GIOI THItU Ngay can bang tai khong la met khai niem meri khong gian mang va may chit Moi loai san phim thuong thgc hien cac cons viec lchac qua trinh can ban! tai Vi du, cac 110 djnh tuyen the phan phoi luu lucmg truy cap th8ng qua Mien tuyen duerng de den cling met dia chi dich vi can bang tai ten cac tai nguyen mang khac Trong di met may chi can bang tai phan phoi luu 'wing giera cac tai nguyen may chi chi khong phai la cac tai nguyen mang Ban dAu be can bang tai bit du veri qua With can bing tai don gian, chimg nhanh chOng duqc phat trien de thgc hien met bat cac chic nang: can bAng tai, Icy thu#t phan ph& luu Itrqngt chuyen mash lugng thong minh Be can bang tai cling c6 the thuc hien cac cuOc kiem tra sic khoe met cach tinh vi ten cac may chii, cac ing dung, va ca nOi dung de cai thien firth sin sang va Ich# Wing quan IS, Bei vi b0 can bang tai dugc trien khai nhu met may chit tiep nh#n you cau cult met nhim cac may chii, chting cling bao ve cac may chi ti ngueri ding dec hai, va tang cuang kha nang an ninh bao mat Dtra‘ tren th8ng tin cac g6i tin IP hoac nei dung cac you cau ing dung, be can bang tai Qua cac quyet dinh thong minh de dinh huang cac luu Wang thich hqp den ding trung tam de lieu, may chi, tiring lira, b0 nher cache, hoac img dung De tai se tap trung nghien ciru tong quan ve may chi can bing tai, cach thic hot dOng cia be can bang tai Wan be he thong mang, tir d6 img dung tren dux to trien Mud be, can bang tai tren toan b0 he thOng met cach hieu qua va (tat dugc hieu suit tot nhat De tai se dtra met m8 hinh cu the, ap dung thu#t toan di chqn Itra de dtra cach nhin re hon ve yin de thing to dang Wang teri 1.1 Sr can fillet cia can bing tai CO hai xu huortg clan den sy can thiet cia can bang di lit may chi va mang Veri st ir vtrgt trei dm Internet va Intranet, ket not mang giita may chi va may tinh ca nhan cia !than vien, khach hang hoac nha cung img di trer titbit 'diem vu quan se khong the chap flan dirge mang bi sap hay the hien kha nang lam viec yeu kern, d6 no hau nhu se tri tre moi host &Ong kinh doanh nen kinh to dua nhieu vkInternet MOt vi du nhu xay dtmg met website thuong mai Bien tir, c6 rat nhieu be phan can dugc xem xet nhu la: b0 djnh tuyen, be chuyen mach, Wang lia , be the dem, may chi web, may chit ca ser cla lieu Hon Ilea viec gia tang nhanh cia ck may chi cho hang lost cac img dung di kW& cho trung tan.' dit lieu day ip cac cum may chi Su r6i ram va thach thirc khit nang nier rOng, kha nang quart ly va khit tiling sin sang cia cia cac nhim may chi la met nhin to dimg ding sau den hei can ci met su thay doi thong minh Met thir ma n8 phai chic chin ve kha nang mer reng va firth sin sang cao cho mgi phan, bat dau tir be dirt tuyen ket not voi Internet, cho to; tat ca cac dutng teri may chi de lieu ben Tir di thiet bi can bang tai St hien nhu la met vu mang me de xi ly nheng van de tren Chuang 1: Gi6i thieu DS Van Thinh — A13439 1.1.1 Mai trwang may chu Sp phat trien manh me cea may chti cac doanh nghiep ngiy va viec cung cap dich vu Internet (ISP) xuat phat tir hai chink Tar& het, co rat nhieu cac Img dung hay dich vu can den k9 nguyen dm Internet nhu Web, FTP, DNS, NFS, Email, database, Tha hai, rat nhieu img dung deli hai can co nhieu may chu cho moi ling dung bed vi met may chit khong the cung cap MI sirc mph hay !chit nang de dux wen cac you cdu ctia Ung dung Nei chuyen v6i bat dr met ngueri nao lam viec von hanh tam dii lieu, he) se cho ban biet can bao nhieu thin gian de xix 19 nhang van de ve kha nang quan 19, kha nang ma rOng va tinh skin sang dm nhieu loci img dung tren cac may chti Vi du, neu met tiring dung email lchting the xi: 19 st ir tang len ye nguiri dung, met may clui mail se duqc bo xung trien khai them Ngutri vim ly cling phai nghi cach de phan tai gitta hai may cliff Neu met may chi' gap van de, ngueri quin trj luc de phai chay ung dung ten met may chif khic may chit van de duqc sin chila Khi no da dugc sin xong, no phai dua ter lai de phuc vu Tat ca nhftng nhiem vu inh huerng tai Tat tinh skin sang va hieu qua dm CEng dung d6 deli v6i ngtreri &mg ve kha ?long ma rang: van de ve quy me ding suet may tinh khong la mai Tn.rerc day, met may chti duqc clanh de chay met img dung Neu may chii de khong hoan nhiem vu, thay vac) de met may chit mph han se dugc mu, meri Stic manh cua cum may chi' tang len tong bo ph#n khic town he thong tra len manh me han Vi du, chung ta da thay toc elm be xti 19 duce Ling gap deli cu sau mai 18 thang - met hien Wong ngly dirge biet tai nhu la luOt clia Moore, dOt theo ten dui Gordon Moore dm top doan Intel Nhtmg nhu eau sir dung may tinh tang thorn chi nhanh han Gong nghe cum (clustering) de da dugc phat mink Thech thzec 1.1.2 Mai truirng mgng Thiet bi chuyen mach truyen thong va be dint' tuyen host dOng tren dja chi IP hoac dia chi MAC de xac djnh diem den curt gel tin, nhi 'en, chimg kh8ng the xi: 19 cac nhu cern dm cac cum may chti phtirc hop hien du Vi du, cac be dinh tuyen hoac b0 chuyen mach khong the thong minh girl ltru luong truy cop den met may chit cu the hoOc be nher cache Neu met may chil dang bj hang, thiet b1 chuyen mach truyen thong yin tiep tuc gfri Iuu Itrqng truy cop vim melt may chi' da chet, de hieu dugc chirc nang ctia HU& N chuyen mach vi thiet 111 (firth tuyen truyen thong thi dau tien chung ta phai kiem tra m8 hinh mang OSI Chuang 1: Gieri thi0 DO Van Minh — A13439 Layer Application Layer Layer Presentation Layer Layer S Session Layer Layer Transport Layer TCP UDP Lam Network Layer IP Layer Data Link Layer Layer Physical Layer IITIR F17 SNMP Telnet DNS Hinh 1.1: so tla ma hinh MO hinh OSI la mOt tieu chitin ma de xac djnh Mm the nao ma cac thiet bj hoc may tinh khac co the giao tiep dugc yeti N6 bao gtim tang, Ur tang vat 1S7 den tang (rug dung tuang Mfg vai cac tang la cac giao thfrc ph6 bien BO chuyen mach va b0 djnh tuyen lam viec a lap va 16.p 3, se xac dinh mOt gei tin phai duqc xir IS , nhu the nao va not ma gei tin phai &gm girl dua tren !hong tin phan header Tuy nhien chang to se khong di qua sou vao m8 hinh de tai 1.2 Can bing dinh nglifit va frng dying VOi su dai dm Internet, mang hien hien chiEm san khau trung tam IChi ma Internet ket not the gith vOi mang b0 ne se ter thank xucmg song hour dOng cho cac doanh nghiep, lac co se hu tang cling nghe thong tin ce the duce coi nhu la hat loai thiet bj: may firth ce chat Ming nhu may khich/ hoc may clth, thiet bj chuyen mach/ b0 djnh tuyen kEt not cac may tinh BO can bang tai la eau n6i gifts cac may cho vi mang dirge the hien ton§ hinh Mitt mitt, bel can bing tai hieu nhieu giao thirc lop cao hon, de ne c6 the giao tiep vai cac may chil thong minh Mat khac, bij can bang tai hieu cac giao thine mang, d6 n6 co the tich hap yen cac mang khic mOt each hieu qua Hinh 1.2: cam may cho vari ba can bang tai Chuong 1: Giai thieu D6 Van Thinh - A13439 Can bang tai dirge img dung rat nhieu twang hap nhu • Can bang tai may chit (Server load balancing) • Can bang tai may chit town cau (Global server load balancing) • Can bang tai tubing lira (Firewall load balacing) • Chuyen mach be nha cache (Transparent cache switching) • Can bang tai tren &rang truyen Internet (Load Balancing with multi wan and failover) • Can bang tai may chti xir ljr v&i viec phan chia tai theo cac may chit (multiple servers), quy m6 hea kha nang litm viec cita timg may chit va dam bao kha nang chit' dung met may chit nao de khong host clang Can bang may chti tat town cau xir l5r viec htrang ngu&i dung truy cap tai nhung diem khac not dat trung tam du lieu, bao grim cac cum may chit c6 kha Ong cung 1mg cho ngtrai dung thai gian phan hei nhanh nhat c6 the va chili dung met trung da lieu mat kha nang lam viec Can bang tai twang hia phan phei tai qua cac twang lira (multiple firewalls), quy mo hoa kha nang cita tong tubing lira vi dam bio kha nang chili dung met tubng lira mat kha nang lam viec hoan town Chuyen mach 60 nha cache la Wang ltru lugng fly cop den cac cache de tang tee theri gian dip thig cho khich hang hoac cai thien hieu sat cim cac may chit Web bang viec tai cac net dung tinh dua den cac cache Can bang tat tren (twang truAn Internet la giii phip &up tang bang th8ng co sin ca kha nang sir dung deng thtri nhieu lien kat NO cung cap can bang tai cho cac nha cung cap dich vu khic va cho cac ket not wan bang viec tOng slicip va tao dieu kien gitip tang kha nang 161 cho mpg dien renf thong qua chuyen doi du phOng Do d6 cac ket not Internet duqc bao dim an Wan, ket not On dinh vol ben ngoii va dam bio chat 'mpg dang tin city truyen din 1.3 Cic san phfim can bAng tai Cac san phim can bang tai co sin duch nhieu hinh thirc khac Chung co the duck phan chia ba loai: sin pham phan mem, thiet bj, vi thiet bi chuyen mach Phan mieu to ciia loai theo sau dual day: • Phan main can bang tdi la phan mem chat' tren ck may chit to can bang tai, Slang phan mem thuc hien cac thuat toin di dieu phial quit trinh phfin phoi tai Chuang 1: Gith thieu DO Van Thinh - A13439 • That 14 can bAng tai IA dm phAm hOp den bao gem phAn ming NM phan mem an duet de thvc hien nhiem vu HOP c6 the don gian nhu met may tinh hoac met may chi, dugc dang gal yeti met s6 hg dieu hint' va phan mem dac bigt hoac met hOp dee quyen vOi phan cling vA phan mem tay chink • Thiit bf chuyin much ma rOng cac chile nang cim mot lap truyen thong (16p 2/3) chuyen dei thAnh cac 16p cao hon bang cach sir dung met so phan cling va phan mem 10 Chuang 2: May chic can bang tai DO Van Thjnh - A13439 CHIANG 2: MAY CHU CAN BANG TAI 2.1 Ding quan Ngay may chit can bang tai khong la mOt khai niern mai the gieri may chit Ck Gong nghe dun may chit da duqc phat minh d'e c6 the thus hien cac uhiem vu tinh toan, nhung lei chi c6duqc thitnh ding mOt s8 it cac th8ng dOc quyen Tuy nhien can bang tai da xuat hien nhu mOt giii phitp mph me clanh cho cac img dung chinh cung nhtr giai quyet cac van de cho timg khu Arc , ne bao gom lcha ndng mer rOng cac nham may chit, tinh san sang, !chit Wins bao mat va ndng %Wit ly, not each khk can bang tai la mOt phucmg pluip phan phoi khOi luqng tai tren nhieu may tinh hoac mOt cum may tinh de c6 the sir dung t6i uu cac ngurin lye, tOi da hOa thong lucmg, giam theri gian dap ting va tranh firth qua tai tren may chit Cac lqi ich sir dung phucmg phip can bang tai: nto Tang khd ndng ddp itng rPng cai thin clang ke kha ndng ma rOng vita mOt ting dung hoac nhem cac may chit bang each phan ph6i tai th8ng qua cac may chit dam bio firth firth host va ma rung cho he th8ng Tang 60 tin cPy link sin sing gitip tang grill sin sang cao (High Availability) cho he thing, bed vi n6 co the dinh huemg cac Itru luqng truy cop den cac may chit thay the neu mOt may chit hoc Ung dung kh8ng the dap img dirge d6ng thin dim bao cho ngtrai dung khong bj gian down dich vu xay l6i str c6 loi tat mOt diem cung cap djch vu Cdi thin khd ndng quits iy theo nhieu each thirc thong qua viec cho phop nhimg ngtrai quan trj mang va may chit chuyen cac img dung tir mot may chit den mOt may chit khac hoac c6 the them nhieu may chit de chay the ang dung nhanh nhat Tang link bdo mPt cho he lung, thong thuang ngueri dung giri you au djch vu den hg thong, zyeu au se duce xir tren boa can bang sau de phin can bang tai mai chuyen tiep cac you eau cho cac may chit ben Qua trinh tra lai cho khach hang ding thong qua thinh phin can bang tai, vi voy ma ngtrai dung khong the Wit duqc chinh xac cac may chit ben ding nhtr phuang ?hap phan tai dugc sit dung Bang each c6 the nglin chan ngu&i dimg giao tiep (rut tiep veri cac may chit, an cac thong tin va cau trite mpg nOi b0, ngan ngua cac cuOc tan cling tren mang hoc cac djch vu khong lien quan dang hoot &Ong tren cac ding khk 2.2 Luan chuyen Wong DNS 11 Chuang 2: May chit can bang tai DO Van Thjnh - A13439 it De can bang tit may chit, he th8ng an phai phan phiii ck yeu a u den nhieu may chit khac ben ctun may cho, vii mix dich toi uu h6a hieu suit he thong Dieu se mang den cho mang hieu suit cao han, nang ma reng, tranh rat vao tinh tong thieu tit nguyen mang met doanh nghiep hay met img dung nao Tinh sin sang cao co the dtrqc hieu 11 firth du thira Neu met may chit Ichong the plan 19 met you cau thi cic may chit khac ton* cum may chti co quart 19 di:cc ne khong? Trong met th6ng c6 !chi nitng‘ cung cap cao, net met may chit bi thi may chd khac se tiep quin dezir 19 yeu cau Kha nang ma reng dm met *rig dung ce the 118 trq duqc so lucmg ngueri ngly met tang Neu no can 10ms de met img dung co the dip Uzi cho met yeu cau thi khoang th6i gian se la bao lau de n6 dap tra den 10.000 yeu cau cling met Mc? Kha nang ma reng v8 hurt se cho phdp no dap tra ck you cau chi khoing 10ms Kha nang ma reng la don vi cho met lost cac he' so nhu so Itrqng ngubi dimg dung thtri ma met cum may chtl c6 the h43 trq va thbi gian no can de xir 19 met you au Frau het chung to co le deu da biet rang, DNS ban di\ h6a ten host ck ilia chi IP Ngubi dung nhip wwwkoircom vio hitp tha chi cite trinh &wet web Web Bravest Cho UN met Oa chi IP cOa Database www.kok.com DNS Sena web Dro'neer Dia chi P cua www.koiccom 222 255.31 160 Database DNS Saver GET 222 255 31.160 Web Stores web &o'er Hinh 2.1 qua trinh chuyin deli host Ma chi 12 Chuang 2: May chi' can bang tai Da Van Thjnh — A13439 Khi nhap mot URL vao trinh (vi du ram www.kok.com ) thi trinh duyet se giri mot yeu cau den DNS yeu cau no tra ve dja chi IP dm site Day dugc goi 11 viec tra ciru DNS Sau trinh duyet Web co dugc dja chi IP cho site thi ne se lien he yeti site bang dja chi IP, vi hien thi trang vim yeu cau May cha DNS thubng co mot dja chi IP dugc ban boa yeti mot ten site nlo d6 Trong vi du thi site la www.kok.com ban hos dja chi IP la 222.255.31.160 De can bin tai bang DNS, may chii DNS phai trinh mot s6 dja chi IP khac cho cling mot ten site INThieu dja chi IP the hien nhieu may mot emu may chia, tat ca so chung deu dugc ban hem den mot ten site logic Trong vi du, www.kok.com c6 the dugc cau hinh tren ba may cha mot cum may cha yen cac dja chi IP dual day: 222.255.31.160 222.255.31.161 222.255.31.162 Trong trutmg hop nay, may chi) DNS dugc ban hea nhu sau: www.kok.com 222.255.31.160 www.kok.com 222.255.31.161 www.kok.com 222.255.31.162 auster 222.255.31.160 www.kok.com 222.255.31.161 Luan chuyon Ana DNS 222.255.31.162 Hinh 2.2: Luein chuyin yang DNS Khi yeu au diu tien den dugc may chi' DNS, no se tra V& dja chi IP 222.255.31.160, may dau tien Khi c6 yeu cau thir hai, n6 se tra ve dja chi IP this hai: 222.255.31.161 Tiip tic nhu vay, veri yeu eau thli tu, dja chi IP diu tien lai dugc lap lai 13 Chuang 2: May chit can bang tai 06 Van Thjnh — A13439 Bang each sir dung luan chuyen wing DNS nhu a tren, tat ca cac you cau dot yeti mot site nao deu &me phan phot i deu den tat ca cac may cum may chit (cluster server) Chinh vi vay, vai phuong phap can bang tai nay, tat ca the may chit cum may chit deu duqc sir clung diim chink ctia phuong plulp a - Khong dit vi ding thiet lip: Cac quan tri vien hg thiing chi can tao mot se thay dot may chit DNS de hi!, trq duqc viec luan chuyen yang, va nhieu may chit DNS da co stir ho trq N6 thong you cau den stir thay del ma cita (mg dung Web; that te, cac (mg dung Web khong he biet ye co the can bang tai ma no hi that hien - Don gian: Phuong phap khong yeu cau den the chuyen gia ye mpg vik thiet lap hoac gia r6i he thong twang hqp co van de nao de xay Nhuvc dam phweng phdp Co hat nhuqc diem chinh cart phuong phap dtra tren phin mem la no thong cung cap sr ht!) trq m8i quan hg thai gian that gifta the may chit veri va khong ht) trq Icha nang co sin cao - Khong ht3 trq m6i quan hc thai gian that gitka cac may chit MOi quan hg thin gian that gift cac may chit la kith nang cita he thong viec quart 1Sr cac yeu cau cita nguiri dung, may chit hok bat kt may chit nao, phu thuOc vio th6ng tin phial ' duqc tri tren may chit hoac tai mire co sit, mac co sit dft - Khong co duqc kha nang ht!) trq mei quan he gift cac may chit, phuang phap loan chuyen yang DNS dtra vio mot ba phuong phap de duqc dtra de tri sit kiem soat cac phial hoc sit nhan clang nguoi clang 461 yea cac you cau dang den ten HTTP • Cac cookie • Cac trutmg An • viEt URL Khi mot nguai dung dux hien mot yeu cau dAu tien, may chit Web se tra mot the bang van bin nhit de phan biet nguai dang Cac you cau tiep theo co the de sir dung cookie, viet 10 URL hoc cac truang An, cho phdp may chit xuat hien de tri mot phien glen may khich vi may chit Khi nguai dimg duet lop mot phien veri mot may chit, thi tat ca cac yeu cau den sau thuang deu di den cling mot may chit Van de a day la trinh duyet luu dia chi IP cart may chit Khi Cache het han, trinh duyet se that hien mot yeu cau khac din voi may chit DNS de co duqc dia chi IP co lien ket yen ten mien Neu may chit DNS tra ye mot dia chi IP khac, mot may chit khac cum may chit, thi cac th8ng tin ye phien se bi mat 14 Chuang 2: May chit can bang tai DO Van Thjnh — A13439 - IChong trq cho kha nang c6 san cao Xem xet met gun may chit co n may Neu met may chit nao d6 gap van de ye stir co (vi dy la may chit thir n) thi cu yeu au thin n den may chit DNS deu huemg yeu au din may chit hong MOt be djnh tuyen thong minh co the giai guy& duqc van de bang cach kiem tra cac may chit cac khoang uteri gian nao do, phat hien cac may chti bj h6ng vi ger b6 chimg Ichoi danh sach, chinh vi vAy se khong co yeu cAu nao duqc gfri den chting nits Tuy 4y, van de a day van ton tsi neu may chil van c6 nhung Cling dung Web dang chay tren may chit eta bj hang i Thay dot cum may chit se mat nhieu thiri pian de truyen bi den toan be plan lai cita Internet MOt IY day la nhieu to chirc tern — cac ISP, cac cong ty, hay dui ly — hru cac you au DNS dm hp de giam Itru luqng mang va thai gian you au Khi ngtreri dimg ben cac t6 chirc nhu v0y thuc hien met yeu au thi hg thong se duqc kiem tra danh sach cac ten DNS cita Cache da duqc ban h6a (Ha chi IP Neu hg th8ng phat hign thiy met muc nao thi no se tra dja chi IP ve cho ngueri dimg Neu no kh8ng phat hien thay muc nao cache nei be thi ISP se giri yeu cau DNS den may chit DNS vi km sr dap tra Khi met muc da duqc luu het hen, ISP se nang cap ca so da ligu n6i be dm no bang ach lien he voi cac may chit DNS khk Khi danh sach cac may chit thay dai, no c6 the can den met Ichoang uteri gian ngin cho cac muc da duqc Iuu tren mang cita ac to chat khic het han va tim kiem danh sach cac may chti da duce cop nh#t Trong su6't chu trinh nay, may khach van co the thuc hien hanh deng " Hit " may chit 1)1 hang, neu ISP cita may khach van c6 met mix tr6 den no Trong twang hcq? nhu 4y, met so ngueri dimg cita ISP d6 khong the truy c#p tir nhemg lin truy c$p ban dliu, tit* tri hien tai cum may chit van cac may chit du thira van dang host deng Met van de Ion han xuat hien ger be met may chit so veri viec ba sung Khi bat di met may chit, ngueri dung co the dang thuc hien " Hit " met may chit khong ton tsi Con them met may chit thi may chit de van chtra duqc sir dung cho toi dja chi IP cita n6 den duqc tat ca cac may chit DNS Mac clit phuong phip c6 the can bang ducc met s6 lircong ngutri dimg tren mai may chit, nhung n6 kh8ng hoin toan can bang tai may chit Met so ngued dimg co the you au mirc tai cao han suot met phien cita hp so veri nhang ngtrai dung khic a tren may chit khic, vi phtrcmg phap khong the bao dam chang lai duqc sit bat cong bing 2.3 Cym may chit voti bt, can bing tai Met vii nha quin tri may chit se trien khai nhieu may chit de dam bao muc dich tang tinh san sang vi kha nang mer ding Neu met may chit nao gap phiti van de kh8ng the dap *rig duqc nhu au, 10p tire met may chti khic cet the duqc mua may chit gap van de se qui trinh sira chaa Tnrerc cac sin phan can pang tai duce phat minh thi DNS thutrng duqc sir dung de phew ph8i tai thong qua nhieu may chit Vi du, 15 Chuang 4: Thiet ke mpg voi 1)(1 can bing tai DO Van Thjnh — A13439 Dieu quan tong la hai can bang tai hoat dOng ciu hinh co tinh san sang cao co mot duemg giao tiep clang tin coy giffa chimg Twc tiep ket not hai NO can bang tai tiep ding th8ng qua mot idiom trunk cita hai hoOc nhieu lien ket de dam bao thong tin lien 1pc dang tin 0y, trir chimg to dang d8i phe veri mot thiet ke da duot trinh bay 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 nao 57 Chacmg 5: ciu hinh cal dat vi thir nahiem DO VAn Thinh - A13439 CHU'ONG 5: CAU HINH CAI HAT VA THU' NGHItM 5.1 Gifri &Fitt • 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 nhu: can bing tai cho cac trang web hog dOng tai cao, dam bao cho djch vv web hog dOng lien tvc ca c6 cac sv c8 ye logical hay vet 19 xay 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 Solaris 8/9 on U1traSPARC and 58 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 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 th8ng nhei chirc Jiang can bang tai vi luu du phong Khuyit diem • Lam tang chi phi trien khai he th8ng • He th8ng phIrc tap ham nen se kho khan 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 59 Chuang 5: cau hinh cai dat va thir nghiem DO Van Thinh — A13439 HAProxy co dia chi 192.168.10.10 May chit chay WebServer va Database c6 dja chi IP 192.168.10.11 May chit chay WebServer NIA Database c6 dja chi IP 192.168.10.12 HAproxy, may chit Nth may chit 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 vi may chit Neu may chit hoac may chit gap phai sr co thi HAProxy se tr6 kat not ye may chit 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 may chit vi may chit 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 60 Chuang 5: au hint' cai dat va thir nghiem DO Van Thinh — A13439 thinhdy'l server: home thinhdv _ X pie Edit ylew imTNInal Tabs yelp 68089 maxconn retries 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 weight 36 check I main frontend which proxys to the backends a backend static balance roundrobin static 192.168.10.10:80 check server thmhdv7server home thrthdy x pie Edit Veva pinta' Tabs Help * static backend for serving up images, stylesheets and such backend static balance server roundrobin static 192.168.18.10:80 check * round robin balancing between the various backends backend app balance roundrobin Kheri dOng Haproxy # service haproxy start 5.4.2 Citi dirt dich vy WebServer tren Server vit Server Tren hai may chit cai dat djch vg Web va deu chay c6ng mac djnh 61 Chuang 5: cAu hinh cai dat vii thin nghiem DO Van Thinh — A13439 Ngoai can to file check.txt thu mpc /var/www/html de HAProxy doe thai caa web server # touch /var/www/html/checktxt # echo "Web Server [1]" > /var/www/html/index.html # service httpd start Truy cAp http://192.168.10.10 /haproxy-status trinh duyet Web se you cAu nhop uesr/pass daa vao tep thu hinh HAProxy x Statl,, tics Report for HAP rory Fi onlla Flrefor - de Edit yiew History fioolanarics "lois Help Ej Statistics Report for HAProxy a * ♦ I Vial" roanrerl „,„ , 51,41 - si ti- ji92.169.10.10Thaproxnutusi gil A HAProxy Statistics Report for pid 25794 > General process Information pia (harm PI, Manx • 1) 2574(flan awlsanis: Who UP Praamd well 2 earn 1 0 at land • 0 0 na circled 75 • 41 Mt Cal 0 'SW (mann glabilatme • mania = • liming i.0 len •• gehne many • 12112:220USea • • maw N UP Int haci Sluicing ambled a impend a "Nat 02111 Isclomp DOWN gong up scan a 104130 C04,04 Caney.' PIM 00 "".” came ' INSiRun g Mt Inaba/ U0 li 0•2 dam, wive CONN gang up 41/0014 atm: manna unlimaild uliman IOU auosaak • ODA maw • 4031 aulapipet laclusp UP wave UP going dawn al OPEN a a • 23 MO 0 a Mt UP 70 r 0 - a 0 0 0 0 28102 UP 10 V 0 ea 2 ••1 10 00 0 0 2mlb UP 10) a 0 5.43 Cid Sat va citu birth KeepAlived trio Haproxy, Server 1, Server Download KeepAlived # yum install libcrypto.so.4 -y # rpm -ivh keepalived-1.1.13-5.e14.rf.i386.rpm Cart hinh keepalived # vim /etc/keepalived/keepalived.conf vrrp_script chk_httpd { script "Wall -0 httpd" interval weight vrrp_instance 62 Chuang 5: cau hinh cal dat va thir nahiem DO Van Thinh — A13439 interface eth0 state MASTER virtual_router_id 51 # 150 master on HAProxy; 120, 100 backup on server], server2 priority 150 authentication auth_type PASS auth_pass 123456 } virtual_ipaddress 192.168.10.15 } track_script { chk_httpd } } thinhclv :server home thInhchr The Edit mew Serval labs help vrrp_script chk_httpd { script "killall -8 httpd" interval weight } vrrp_instance VI _1 { state MASTER interface eth0 virtual_router_id 51 priority 150 advert_int authentication { auth_type PASS auth_pass 123456 } virtual_ipaddress { 192.168.18.15 } track_script { chk_httpd } } virtual_server 192.168.208.180 443 delarloop CAu hinh HAproxv voi Ao # vim /etc/haproxy/haproxy.cfg default 63 Chuong 5: cAu hinh cai dat va thir nuhiem DO Van Thinh — A13439 # Dori thimh clia chi IP cio listen webfarm 192.168.10.15: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/I.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 thinhdv server home thinhdv Ede Edit ylew Terminal Taps Help listen webfarm 192.168.18.15:801 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 JSESSIONID prefix option httpclose option forwardfor option httpchk HEAD /check.txt H7715/1.0 server webl 192.168.10.11:80 cookie A weight 78 check server web2 192.168.18.12:88 cookie weight 38 check S main frontend which proxys to the backends backend static balance roundrobin static 192.168.10.10:80 check server 64 DO Van Thinh — A13439 Chuang 5: cau hinh cal dat va thin nghiem thinhdv server: home , thinhdv The Edit yievi Terminal Tags Help * static backend for serving up images, stylesheets and such backend static balance roundrobin server 'static 192.168.10.15:80 check S round robin balancing between the various backends 5.5 Kiem tra & Dinh gii ket qui De kiem tra xem HAProxy co thwc hien can bang tai khong to can co hai trinh duyet web khac nhu Mozilla Firefox vi Google Chrome Hoac co hai may khitch kat not tai proxy de tranh tinh tang btu cookies Trwong hpp m(31 Truy cap thong ke http://192.168.10.15 /haproxy-status X Stati• ics Report for HAPro.y - lgozllla trefox Ble Ern zee IUatoiy Boolanarks Dols lielp I Statistics Report for HAProxy • I L 10041:4112.tat1eataiii #1.fri S 192.168.10.15Thaproxy-status > General process Information pid • 3251 (Pawl nOptx • I) • 00 • 00 mane 22•0111.1ta: inemna• • unkmnd Simon • 1011 mosaic • WA •owana • a 4,010•• carnal Gonna 1, carnal pipssat solve UP •E a • 7 3001 10 02 • 1 • 3 1011 NO Mc SS 0 O a °I ° °I °I °I° °I °"& ] MOM 21111 ED 171 510104 CO O M Cl I °I s /10.2202S2111 • • RBIS • it= Ni • railin• no t • =Suss • Use mama ONicup C430 na chided Extental 000,1 R: • wiveC0.gc0laispCON.03 up web700•01 ROMNIIII o1 11200p UP mom• up yang dawn Stipp UP 0/9 00 SO aorta WPM 0 D 10E0 UP 70 • NEON 0 0 1000 UP 3) • SE EIENEEME 0 33.a a SIMI l ° 1° "4"° I I Y I ' l °I 13 1j Truy cap may chit Web ten may may khach ved dia chi 192.168.10.15, kiem tra ck y'eu eau de duce truy xuAt den may chi' va may clui chua 65 DO Van Thinh - A13439 Chuang 5: eau birth cai dat vi thir mdulem x Manila f veto• gle Edit glen History goolonarks • Dots He I+I http://192.168.10.15/ 192.168.10.15 Web Server [1] r elay E6e Era Von History flookmarks gaols Help ir ] Otto //192 168 10 15/ E 192.168.10.15 Web Server [2] Trwong Itcp hai Tren may chit 2, tat dich NT Web # service httpd stop Tren may khach, truy cop 13i (Ha chi may chit Web 192.168.10.15 Manila f irefov gle Edit Vow History goolcmarks gaols yelp • IL; V 14A I n ittp://192.166.10.15/ al 192.168.10.15 Web Server [1] 136'ng that kiem tra teen may ad Haproxy Stati:tirs Report for HAPror gle Es View History Bookmarks Isola yelp r; Robotics Report for HOProxY it X Ftrefox •i V to 192.168.10.15maproxy • status re Statistics Report for pid 16478 41 > General process information pid • Sae Omni& Pans • A oche up Saco UP Maas • Od Ihierit231 cam UR going dam Sap UR IMO aim • ato Nails: MINIXIM • ohms& WIMIIII eon Inn contr aka up Yaw COOL Via up sass* • !Da someam • at pla•pIpes •0 no a Setup DOWN no chided current conns • L apnea paa• OD Running tam 314 NOV UP IV loadaJwarq day! s nand 'Nat XIS 32 •ISO fl la O al O a O O la O 31 IMOD MO lsla 1700) e1a01e O acrl II ad M 1140100 aa0w lain MOOS DiSplay apear tatr•l to • aslitniogi • amismite • • Ostoatior • nag • nttlf.nta • a • k OWN MB 0 0 la UP ID • 0 0 MI UP ID 66 Chucmg 5: cau hinh cal dat va thir nghiem DI) Van Thinh — A13439 Truing hip ba Tren HAProxy va may chi 1, tit djch vv keepalived # service keepalived stop Truy cap lai may chi Web 192.168.10.15 rionlla F Irigo Elie Edit Mew History ftookmada Dols i E.] hdp://192.168.10.15/ Help Lai Ej 192168.1015 Web Server [2] Qua ket qui tren, chting ta c6 the danh gia mot cach trvc quart sir dung bO can bin tai may chi nhu sau: Thu !that la tang kha nail dap img mo rong, de ding them hoac bit may chi mot each de ding nham dap img nhu cau can thiet vii yeu cau cong viec Trong twang hqp thir nghiem tren, thing ta c6 the them mot so may chit vii cling dii dja chi IP 192.168.10.x hoac gilm bit cac may chi di Thu hai la tang cuing tin cay, dap img flan dg phong, mot may chit gap phii sty co thi he thong van dtrqc tri hog dOng khong he bj gian down Thu ba la chin ta ci the de ding theo dei tinh Wang cia cac may chi thong qua giao dien mot may chi nio di gap phii sv co Tiep theo chfing ta se ding danh gia hieu suit cong viec sir ding b0 can bang tai mo hinh thir nghiep tren vi so sinh yen viec chi sir ding mot may chi hoot dOng cung cap djch Ai Web Ching ta se sir thing phan mem WAPT la mot cong cv thir nghiem tai cung cap chi phi hieu qui de kiem tra bat Ict dich , vy may chit web nao bao g6m ea ling citing Icinh doanh, cong thong tin web, phan mem gitip thing ta c6 the tao cac bai kiem tra tai yang vii phit Qua trinh kiem tra va danh gia cis chin ta se &Km tien hanh yeti hai truing hqp tren thong qua each thirc sir ding mot Itnyng ngu&i ding that dinh tang tir den 20 ngutii, thing th&i troy cop lay thong tin tren may chi web mot khoang thai gian ngan TrtrOng hqp thir nghiem can bang till vii HAproxy sir dtmg dja chi IP a° 192.168.10.15 cho ta ket qui nhu sau: 67 DO Van Thinh — A13439 Chucme 5: eau hinh cal dat vi thin nghiem Average response time (without page elements) Profile 1.Load Solacing httn•iii ims.tri.ts:ani 0.1B 20 0.16 18 0.14 16 14 0.1.2 12 0.10 10 0.08 0.06 0.04 0.02 0.00 0:00:00 Active users 0:00:20 0:00:40 • Avg response time, sec 0:01:00 0:01:20 0:01:40 la Avg 90% response One, sec Tnging hop thin nghieM yea may cher djch Web thong during sir dung dia chi 192.168.10.11 cho to ket qua nhu sau: Average response time (without page elements) Profile1.Load Solacing mtnun92.7 6s.in.LI :Rn/ 68 Chuong 5: cau hinh cal dat va this nghiem DO Van Thinh - A13439 Co the nhan xet inns sau: Khi chimg ta tien hanh kiem tra ltru luring tai voi mOt luring ngueri dung Ling dan mOt khoang thin gian ngin [that djnh Doi ydi truing hop sir dong1340 can bang tai thong qua dia chi 192.168.10.15, that gian phitn hoi cac yeu dm se tang din theo so luring ngtricri dung, den ,m0t nguang nick djnh nao d6 qua trash tra 161 cac yeu cau girl , den khOng theo kip so luong cac yeu cau, lac thai gian phan hoi se lau han co so tac va can that gian xir 1St Chimg ta co the thay trutmg hop chi sir dung mOt may chit cai dat djch vo Web thong qua dja chi )92.168.10.11 Thai gian phim hoi dm may chit dot net tang len so luring yeu cau tir nguei dimg tang len 69 Ket luan va huong phat thin de tai DO Van Thjnh A13439 - KET LUAN VA HUY/NG PHAT TRIEN DE TAI Ket luen Can bang tai mang lai Id ich to 16n bang each cai thien tinh sin sang dm he thong may chit, kha nails ma rung quart ljr va an ninh bao mat Can bang tai may chit la img dung ph6 bien nhat cho bo can bang tai Ngay ding veri sit phat trien vuqt bac cua cong nghe, can bang tai da vi dang phat trien mOt cach manh me de giii quyet cac sv co tat mang va may chit, dem lai giai phap hieu qua nhat cho cac cong ty, doanh nghiep Bang viec img dung va trien khai cac thiet ke m8 hinh can bang, tai mang tinh sin sang cao, cac cong ty, doanh nghiep cc!) the dap ling dirge Man b0 nhu clu cong viec Thong qua bao cao khaa luan "Tim hieu he thong can bang tai may chit", da co nhung dong gap, ye mat thuyet cling nhu ye mat cong nghe viec tim hieu va xay dung cac he thong can bang tai may chit Sau day la ket qua chinh ma ae tai da dirt duqc: • • • • Trinh bay ding quan ve he thong may chit can bang tai Gieri thieu cac thuat town *rig dung can bang it Xay dung car thiet ke mpg voi b0 can bang tai du hinh cal (tat thin nghiem mo hinh may chit can bang tai, dua (lath gia ding quat Trong pham vi mOt luan van, han the ve theri gian nghien ciru vi cac yeu t6 khach quan khac, mOt so van de lien quan cna de tai co the vAn clam giii quyet duce mOt each trcm yen, nhung mong rang day la nhung n,Oi dung tim hieu ca ban ,dat nen tang cho sr phat trien nhung nghien sau them ye he thong may chit can bang tai Hurting phit trien de di NhUng van de duqc de cap luan van men chi tap trung chit yeu vao nen tang ca ban cita he thong may chit can bang tai va l± thuyet xay dung no Ngoai mo phOng mdi chi dap img phan nho trien khai thvc te Mac du vay, luan van cling da dinh hang de phat trien mOt he thong may chit phuc vu Ott cho nhu cau cda cac ding ty vi doanh nghiep Trong theri gian teri, luan van se di sau vao nhung Ichia canh khac Fla he thong can bang tai dien hinh nhu: can bang tai tren ettremg truyen Internet, can bang it tirtmg lira 70 Danh mvc tai lieu tham khao DO Van Thjnh — A13439 DANH MVC TAI LItU THAM MAO Nguyen Truerng Giang "Tai lieu HAproxy tren CentOS" Giang vien Trung tat n ' quan trj mpg PNH Hit NOi 2010 Tran Binh "Cong nghe can bang tat " http://www.vnnic.vtildns/congngheicongnghe-can-bing-tai 2012 Chandra Kopparapu "Load Balancing Servers, Firewalls, and Caches" Wiley Canada 2002 Tony Bourke "Server Load Balancing" O'Reilly & Associates, Boa K5/ 2001 Yu ShengSheng, Lu Song, Zhou Jingli "Load Balancing Algorithms" DO hoc khoa hoc va cong nghe Tnmg Quoc 2004 John Lewis "Icy thuat tong quan mgng can bang tin" http://technet.microsoft.comienus/1 ibrarv/bb742455 aspx#X SLTsection124121120 120 2003 71