真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

LNMP+Tomcat+Keepalived+LVS多端口負(fù)載均衡

應(yīng)用場(chǎng)景:Keepalived+LVS高可+負(fù)載均衡集群架構(gòu)中rs同時(shí)跑httpd(80端口)和Java(8080端口)服務(wù),使用Keepalived負(fù)載均衡多個(gè)端口。 如果想全部由80端口提供服務(wù),則Keepalived+LVS負(fù)載均衡層就只開啟80端口,內(nèi)部節(jié)點(diǎn)使用nginx代理8080端口。

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的丹徒網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

多端口負(fù)載均衡

[root@director sbin]# yum install -y keepalived [root@Centos-1 sbin]# vim /etc/keepalived/keepalived.conf vrrp_instance VI_1 { state BACKUP interface ens192 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass password } virtual_ipaddress { 192.168.14.13 } } virtual_server 192.168.14.13 80 { delay_loop 10 lb_algo wlc lb_kind DR persistence_timeout 180 protocol TCP real_server 192.168.14.127 80 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 192.168.14.128 80 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 192.168.14.129 80 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } } virtual_server 192.168.14.13 8080 { delay_loop 10 lb_algo wlc lb_kind DR persistence_timeout 180 protocol TCP real_server 192.168.14.127 8080 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 192.168.14.128 8080 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 192.168.14.129 8080 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } }

在dir2上執(zhí)行同樣的操作,lvs多端口負(fù)載均衡,需要注意的是dir2機(jī)器上state改為BACKUP,priority設(shè)為90。

nginx反向代理Tomcat

在rs上創(chuàng)建nginx代理虛擬主機(jī),名為zrlog.conf,然后配置內(nèi)容如下:

[root@128rs2 ~]# vim /usr/local/nginx/conf/vhosts/zrlog.conf server { listen 80; server_name www.3zuzrlog.com; location / { proxy_pass http://localhost:8080; proxy_redirect default; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }

此時(shí)Keepalived+LVS只需監(jiān)聽80端口即可:

[root@Centos-1 sbin]# vim /etc/keepalived/keepalived.conf vrrp_instance VI_1 { state BACKUP interface ens192 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass password } virtual_ipaddress { 192.168.14.13 } } virtual_server 192.168.14.13 80 { delay_loop 10 lb_algo wlc lb_kind DR persistence_timeout 180 protocol TCP real_server 192.168.14.127 80 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 192.168.14.128 80 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 192.168.14.129 80 { weight 100 TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } }


標(biāo)題名稱:LNMP+Tomcat+Keepalived+LVS多端口負(fù)載均衡
標(biāo)題網(wǎng)址:http://weahome.cn/article/cgjogj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部