In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The following brings you how to build a LVS-NAT load balancing cluster, hoping to give you some help in practical application. Load balancing involves a lot of 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.
Build LVS-NAT load balancer cluster experimental environment: host operating system IP address LVS load scheduler CentOS 7.3 x86164 inside: 192.168.1.100 outside: 12.0.0.1web CVM 1CentOS 7.3 x86_64192.168.1.101web server 2CentOS 7.3 x86_64192.168.1.102NFS shared storage CentOS 7.3 x86 address 64192.168.1.103 client Windows 712.0.0.12
Note: the LVS scheduler acts as a gateway server with two network cards.
Configure NFS to turn off the firewall, edit the configuration file: vim / etc/exports/opt/benet 192.168.1.0 rw,sync 24 (rw,sync) # read and write remote synchronization / opt/accp 192.168.1.0 max 24 (rw,sync)
Note: if a shared folder does not exist to be created, you can actually do a disk array mount in the shared folder.
Create a shared folder and add permissions for files: mkdir / opt/benet / opt/accp chmod 777 benet accp to enable the service Release sharing: systemctl start rpcbind.service # enable remote procedure call protocol systemctl start nfs.service # enable nfs service exportfs-rv # publish sharing showmount-e 192.168.1.103 # Test whether this machine is shared
Note: some systems may not have nfs-utils installed for NFS sharing publishing and access.
Configure web server to install httpd service Edit configuration file: vim / usr/local/apache/conf/httpd.conf Listen 192.168.1.101NFS 80 # modify IP ServerName www.yun.com:80 # change domain name mount file share provided by NFS: showmount-e 192.168.1.103 # check whether there is a shared file mount.nfs 192.168.1.103:/opt/benet / var/www/html # Mount the shared file provided by NFS to the httpd site and add a httpd home page Turn off the firewall: echo "this is benet" > / var/www/html/index.htmlsystemctl stop firewalld.service
Note: you can locally test whether the test home page can be opened. The two web servers have the same configuration and add different home pages to make a distinction.
Configure the LVS load scheduler to install dual network cards to serve as gateway servers. Enable route forwarding function: vim / etc/sysctl.conf net.ipv4.ip_forward=1 # add sysctl-p # load LVS template: modprobe ip_vs # load template cat / proc/net/ip_vs # View version information install management software, add server node Enable service: yum install ipvsadm-y ipvsadm-C # Clean server node ipvsadm-A-t 12.0.0.1 rr 80-s rr # add virtual server ipvsadm-a-t 12.0.0.1ipvsadm 80-r 192.168.1.101purge 80-mipvsadm-a-t 12.0.0.1ipvsadm 80-r 192.168.1.102 : 80-mipvsadm-- save > / etc/sysconfig/ipvsadm # Save policy (required to enable ipvsadm service above 7) ipvsadm-ln # View node status ipvsadm # enable service
Note:-An add virtual server,-s load scheduling algorithm, rr polling,-an add real server,-t specify virtual IP and TCP port,-r specify real IP and TCP port,-m use NAT cluster mode,-d delete
Set firewall rules: iptables-t nat-F # clear rules in nat table iptables-F # clear firewall default table rule chain iptables-t nat-A POSTROUTING-o ens34-s 192.168.1.0 to-source 24-j SNAT-- to-source 12.0.0.1
Note:-o Export network card 12.0.0.1 network card name
Test to open win access 12.0.0.1
Note: sometimes the refresh may not jump and the cache needs to be cleared.
After reading the above about how to build a LVS-NAT load balancing cluster, 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 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.