In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The following brings you a detailed explanation of LVS load balancing Cluster-address Translation Model (LVS-NAT), hoping to give you some help in practical application. Load balancing involves more things, there are not many theories, and there are many books on the Internet. Today, we will use the accumulated experience in the industry to do an answer.
LVS load balancing Cluster-address Translation Mode (LVS-NAT)
Environment:
Schedule a CVM: Linux-CentOS7.4
IP address: 192.168.80.20 (intranet)
192.168.90.20 (external network)
Two Web servers: Linux-CentOS7.4
IP address: 192.168.80.30 (SERVER AA)
IP address: 192.168.80.40 (SERVER BB)
Client 1: take win7 as an example for testing and verification
IP address: 192.168.80.2 (intranet)
IP address: 192.168.90.2 (public network)
Step 1: configure the scheduling server
/ / load LVS kernel module
LVS, which is now part of the Linux kernel, is compiled as an ip_vs module by default and can be invoked automatically if necessary. You can manually load the ip_vs module and view the version information of the ip_vs module on the current system by doing the following
[root@localhost ~] # modprobe ip_vs
[root@localhost ~] # cat / proc/net/ip_vs
/ / install the management software ipvsadm, no need to start it
[root@localhost] # rpm-ivh / mnt/Packages/ipvsadm-1.27-7.el7.x86_64.rpm
/ / Edit the scheduling server script
[root@localhost ~] # vi nat.sh
#! / bin/bash
Echo "1" > / proc/sys/net/ipv4/ip_forward / / enable routing address translation
Ipvsadm-C / / clears all records in the kernel virtual server table
Ipvsadm-A-t 192.168.90.20 ipvsadm 80-s rr / / create a virtual server
Ipvsadm-a-t 192.168.90.20 80-r 192.168.80.30 purl 80-m / / add server node
Ipvsadm-a-t 192.168.90.20 80-r 192.168.80.40 purl 80-m / / add server node
Ipvsadm-Ln / / View node status and add "- n" to display address and port information in numeric form
Save exit
/ / option Notes:
"- A" means to add a virtual server
"- a" means to add a real server
"- t" is used to specify VIP address and TCP port
"- r" is used to specify the RIP address and TCP port
"- s" is used to specify load scheduling algorithms-rr (polling), wrr (weighted polling), lc (minimum connections), wlc (weighted least connections)
"- m" indicates using NAT cluster mode ("- g" is DR mode, "- I" is TUN mode)
[root@localhost ~] # sh nat.sh
Step 2: configure the Web server
Configure the SERVER AA server (192.168.80.30)
/ / install http service
[root@localhost ~] # yum install-y httpd
/ / Edit the main configuration file
[root@localhost ~] # vi / etc/httpd/conf/httpd.conf
ServerName localhost / / remove the "#" number and modify the host name
Save exit
/ / configure the default display web page
[root@localhost ~] # cd / var/www/html/
[root@localhost html] # echo "SERVER AA" > index.html
[root@localhost html] # systemctl restart httpd / / restart the http service
/ / configure server gateway
[root@localhost ~] # vi / etc/sysconfig/network-scripts/ifcfg-ens33
Finally, add a line:
GATEWAY=192.168.80.20
Save exit
[root@localhost ~] # systemctl restart network
/ / win7 verifies the http service
Visit http://192.168.80.30
Configure the SERVER BB server (192.168.80.40)
/ / install http service
[root@localhost ~] # yum install-y httpd
/ / Edit the main configuration file
[root@localhost ~] # vi / etc/httpd/conf/httpd.conf
ServerName localhost / / remove the "#" number and modify the host name
Save exit
/ / configure the default display web page
[root@localhost ~] # cd / var/www/html/
[root@localhost html] # echo "SERVER BB" > index.html
[root@localhost html] # systemctl restart httpd / / restart the http service
/ / configure server gateway
[root@localhost ~] # vi / etc/sysconfig/network-scripts/ifcfg-ens33
Finally, add a line:
GATEWAY=192.168.80.20
Save exit
[root@localhost ~] # systemctl restart network
/ / win7 verifies the http service
Visit http://192.168.80.40
Step 3: verify
Win7 visits http://192.168.90.20 to open a few more tasks
/ / verify successfully
After reading the above detailed explanation of LVS load balancing Cluster-address Translation Model (LVS-NAT), if you have anything else you need to know, you can find what you are interested in in the industry information or find our professional and technical engineers for answers. Technical engineers have 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.
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.