In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about LVS-DR cluster mode + keepalived how to achieve high availability, the article is rich in content and professional analysis and description for you, I hope you can get something after reading this article.
Conditions: five virtual machines:
(main) load scheduler:
Create a mapped port (VIP)
Optimize the environment: (/ etc/sysctl.conf)
Net.ipv4.conf.all.send_redirects = 0
Net.ipv4.conf.default.send_redirects = 0
Net.ipv4.conf.eth0.send_redirects = 0
Sysctl-p
Load ip_vs module
Modprobe ip_vs
View ipvs
Cat / proc/net/ip_vs
Install IPVS
Yum install-y ipvsadm
View the version:
Ipvsadm-v
Set load scheduler setting mode
Ipvsadm-A-t 192.168.115.100 ipvsadm 80-s rr
Ipvsadm-a-t 192.168.115.100 RS 80-r 192.168.115.173 80-g
Ipvsadm-a-t 192.168.115.100 purl 80-r 192.168.115.176 purl 80-g
View:
Ipvsadm-Ln
Install keepalived
Yum install-y gcc* kernel-devel openssl-devel popt-devel ipvsadm
Tar-xvf keepalived-1.2.7.tar.gz
. / configure-- prefix=/-- with-kernel-dir=/usr/src/kernels/2.6.32-131.0.15.el6.i686
Make & & make install
Chkconfig-add keepalived
Chkconfig keepalived on
Configure the keepalived file:
Start the service:
Service keepalived start
Chkconfig keepalived on
Shared Resource Server:
Set up NFS for RS to hang in use
RS1:
Install the Apache service
Configure local loopback port mapping:
Set up a route:
Route add-host 192.168.115.100 dev lo:0
Optimize the environment:
Net.ipv4.conf.all.arp_ignore = 1
Net.ipv4.conf.all.arp_announce = 2
Net.ipv4.conf.default.arp_ignore = 1
Net.ipv4.conf.default.arp_announce = 2
Net.ipv4.conf.lo.arp_ignore = 1
Net.ipv4.conf.lo.arp_announce = 2
RS2:
Install the Apache service and hang the content from the NFS server:
Mount-t nfs 192.168.115.177:/share / var/www/html
Set up the mapping network card:
Optimize the environment:
Net.ipv4.conf.all.arp_ignore = 1
Net.ipv4.conf.all.arp_announce = 2
Net.ipv4.conf.default.arp_announce = 2
Net.ipv4.conf.default.arp_ignore = 1
Net.ipv4.conf.lo.arp_ignore = 1
Net.ipv4.conf.lo.arp_announce = 2
Set up routing:
Set up a route:
Route add-host 192.168.115.100 dev lo:0
Test machine access:
With each refresh, the content is polled:
The following is to build LVS-DR based on keepalived
Add a virtual machine as a slave load scheduler:
Load ip_vs module
Modprobe ip_vs
View ipvs
Cat / proc/net/ip_vs
Install IPVS
Yum install-y ipvsadm
View the version:
Ipvsadm-v
Set load scheduler setting mode
Ipvsadm-A-t 192.168.115.100 ipvsadm 80-s rr
Ipvsadm-a-t 192.168.115.100 RS 80-r 192.168.115.173 80-g
Ipvsadm-a-t 192.168.115.100 purl 80-r 192.168.115.176 purl 80-g
View:
Ipvsadm-Ln
Optimize the environment:
Net.ipv4.conf.all.send_redirects = 0
Net.ipv4.conf.default.send_redirects = 0
Net.ipv4.conf.eth0.send_redirects = 0
Install keepalived
Yum install-y gcc* kernel-devel openssl-devel popt-devel ipvsadm
Tar-xvf keepalived-1.2.7.tar.gz
. / configure-- prefix=/-- with-kernel-dir=/usr/src/kernels/2.6.32-131.0.15.el6.i686
Make & & make install
Chkconfig-add keepalived
Chkconfig keepalived on
Service keepalived start
Chkconfig keepalived on
Test machine test:
Successfully taking over from the server: the experiment was successful:
Profile template:
! Configuration File for keepalived
Global_defs {
Router_id LVS_R1
}
Vrrp_instance VI_1 {
State MASTER
Interface eth0
Virtual_router_id 51
Priority 100
Advert_int 1
Authentication {
Auth_type PASS
Auth_pass 1111
}
Virtual_ipaddress {
192.168.115.100
}
}
Virtual_server 192.168.115.100 80 {
Delay_loop 6
Lb_algo rr
Lb_kind DR
Protocol TCP
Real_server 192.168.115.173 80 {
Weight 1
TCP_CHECK {
Connect_port 80
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
}
}
Real_server 192.168.115.176 80 {
Weight 1
TCP_CHECK {
Connect_port 80
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
}
}
}
When doing the slave load scheduler, because two network cards share the same address, an error will be reported when starting the network card.
Solution:
Vim / etc/sysconfig/network-scripts/ifup-eth
Just annotate the contents of the icon.
Then restart the network card
The above is the LVS-DR cluster mode + keepalived shared by Xiaobian to achieve high availability. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.