In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
LVS/DR configuration
Prepare 3 machines:
Dir (192.168.220.141)
Rs1 (192.168. 220.143)
Rs2 (192.168.220.144)
Vip (192.168.220.110)
Vim / usr/local/sbin/lvs_dr.sh / / added on Director
#! / bin/bash
Echo 1 > / proc/sys/net/ipv4/ip_forward
Ipv=/sbin/ipvsadm
Vip=192.168.220.110
Rs1=192.168.220.143
Rs2=192.168.220.144
Ifconfig eth0:0$ vip broadcast $vip netmask 255.255.255.255 up
Route add-host $vip dev eth0:0
$ipv-C
$ipv-A-t $vip:80-s rr
$ipv-a-t $vip:80-r $rs1:80-g-w 1
$ipv-a-t $vip:80-r $rs2:80-g-w 1
On two rs: vim / usr/local/sbin/lvs_dr_rs.sh
#! / bin/bash
Vip=192.168.220.110
Ifconfig lo:0$ vip broadcast $vip netmask 255.255.255.255 up
Route add-host $vip lo:0
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
Then execute on director: bash / usr/local/sbin/lvs_dr.sh
Execute on two rs: bash / usr/local/sbin/lvs_dr_rs.sh
Browser test access under Windows
Combined with keepalived
Prepare another machine as a backup dir (192.168.220.129)
On the main dir
Vim / etc/keepalived/keepalived.conf
Vrrp_instance VI_1 {
State MASTER # BACKUP on the standby server
Interface eth0
Virtual_router_id 51
90 on priority 100 # standby server
Advert_int 1
Authentication {
Auth_type PASS
Auth_pass 1111
}
Virtual_ipaddress {
192.168.220.110
}
}
Virtual_server 192.168.220.110 80 {
Delay_loop 6 # (query realserver status every 10 seconds)
Lb_algo wlc # (lvs algorithm)
Lb_kind DR # (Direct Route)
Persistence_timeout 60 # (connections to the same IP are assigned to the same realserver within 60 seconds)
Protocol TCP # (check realserver status with TCP protocol)
Real_server 192.168.220.143 80 {
Weight 100 # (weight)
TCP_CHECK {
Connect_timeout 10 # (10 seconds no response timeout)
Nb_get_retry 3
Delay_before_retry 3
Connect_port 80
}
}
Real_server 192.168.220.144 80 {
Weight 100
TCP_CHECK {
Connect_timeout 10
Nb_get_retry 3
Delay_before_retry 3
Connect_port 80
}
}
}
Scp / etc/keepalived/keepalived.conf 192.168.220.129://etc/keepalived/keepalived.conf
On standby dir
Vim / etc/keepalived/keepalived.conf
Modify the following:
State MASTER-> state BACKUP
Priority 100-> priority 90
After configuring keepalived, you need to enable port forwarding (both master and slave):
Echo 1 > / proc/sys/net/ipv4/ip_forward
Then, execute the / usr/local/sbin/lvs_dr_rs.sh script on both rs
Finally, start the keepalived service (master then slave) on the two director:
/ etc/init.d/keepalived start
In addition, it is important to note that starting the keepalived service automatically generates vip and ipvsadm rules, eliminating the need to execute the / usr/local/sbin/lvs_dr.sh script mentioned above.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.