Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The operation process of realizing Keepalived load balancing

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following brings you the operation process of realizing Keepalived load balancing, hoping to bring some help to you in practical application. Load balancing involves many things, and there are not many theories. There are many books on the Internet. Today, we will use the accumulated experience in the industry to do an answer.

Operation process

Set up the web CVM and set the gateway of the loop ENI to: vip to build the master and backup test results of the keepalive:

Active and standby routing machine, which can be replenished automatically

Web server can realize, load, answer hold

Server Node-IP

Route forwarder-master: 192.168.2.30 route forwarder-standby: 192.168.2.31web server (node-0): 192.168.2.32web server (node-1): 192.168.2.33vip: 192.168.2.50

1. Set up web server

/ / install httpd service yum-y install httpd / / set boot up Now start systemctl enable httpd & & systemctl start httpd// to set the gateway of the loop network card ifconfig lo:1 192.168.2.50 netmask 255.255.255.255echo 1 > / proc/sys/net/ipv4/conf/all/arp_ignoreecho 1 > / proc/sys/net/ipv4/conf/lo/arp_ignoreecho 2 > / proc/sys/net/ipv4/conf/all/arp_announceecho 2 > / proc/sys/net/ipv4/conf/lo/arp_announce

two。 Set up the master and standby of keepalive

/ / 2-1. [main transponder] build / / install service yum-y install keepalived ipvsadm// configure vim / etc/keepalived/keepalived.conf

/ / Boot, boot systemctl enable keepalived & & systemctl start keepalived// test view, you should see that there are two IP: 192.168.2.30192.168.2.50ip _ a _ yum / 2-2. [backup] build / / install service yum-y install keepalived ipvsadm// configuration vim / etc/keepalived/keepalived.conf// configuration consistent with the master server need to adjust the following parameters. Vrrp_instance VI_1 {. / / [backup machine] Mark state BACKUP / / [backup machine] weight must be less than host priority 90.} / / start, boot systemctl enable keepalived & & systemctl start keepalived// test check, you should see an IP: 192.168.2.31

3. Test effect

/ / 3-1. Repeater: [active / standby / transponder] automatically detects each other, replaces / / stops: [master-transponder], run command on [standby-transponder]: ip a VIP / you can see that the VIP is brought over, two IP: 192.168.2.31192.168.2.50mp / 3-2. Check the web service load / / current client (win10), crawl the web service web page (do not test with the browser, it is easy to have static file cache): curl 192.168.2.50 Universe / check the forwarding result, run the command in [standby-transponder]:

Ipvsadm-Ln

After reading the above about the operation process of realizing Keepalived load balancing, if you have anything else you need to know, you can find out what you are interested in in the industry information or find our professional technical engineer to answer it. The technical engineer has more than ten years of experience in the industry.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report