In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
LVS load balancing cluster
Environmental preparation:
CentOS 7-1: scheduler, gateway (requires two network cards) outside: 12.0.0.1 inside: 192.168.200.1
CentOS 7-2: website Server (Apache) 192.168.200.110
CentOS 7-3: website server (Apache) 192.168.200.120
CentOS 7-4: provides shared storage 192.168.200.130
Win7-1: client 12.0.0.12
Pre-operation of yum online installation:
1. Operations of the shared storage server CentOS 7-4:
[root@localhost ~] # rpm-Q nfs-utilsnfs-utils-1.3.0-0.48.el7.x86_64 [root@localhost ~] # rpm-Q rpcbind rpcbind-0.2.0-42.el7.x86_64
two。 Node servers CentOS 7-2 and 7-3 two node servers:
[root@localhost ~] # yum install httpd-y
3. Scheduler Gateway CentOS 7-1 Operation:
/ / to first add a network adapter to become two network cards [root@localhost ~] # yum install ipvsadm-y shared storage server CentOS 7-4 CentOS / change the network card to host-only mode [root@localhost ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33BOOTPROTO= "static" / / change dhcp to staticDEVICE= "ens33" ONBOOT= "yes" IPADDR=192.168.200.130 / / insert under the last line: IP, subnet Enter: wq save exit [root@localhost ~] # service network restart Restarting network (via systemctl): [OK] [root@localhost ~] # systemctl stop firewalld.service [root@localhost ~] # setenforce 0 [root@localhost ~] # systemctl start nfs.service [root@localhost ~] # systemctl status nfs.service ● nfs-server.service-NFS server and services after the modification of the gateway is completed Loaded: loaded (/ usr/lib/systemd/system/nfs-server.service) Disabled; vendor preset: disabled) Active: active (exited) since II 2019-11-26 17:42:05 CST; 11s ago. Omit multiple lines and the status is Active. Normal [root@localhost ~] # systemctl start rpcbind.service [root@localhost ~] # systemctl status rpcbind.service ● rpcbind.service-RPC bind service Loaded: loaded (/ usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled) Active: active (running) since II 2019-11-26 17:40:23 CST; 4min 26s ago. Omit multiple lines Status: Active indicates normal [root@localhost ~] # vim / etc/exports/usr/share * (ro,sync) / opt/accp 192.168.200.0Accord 24 (rw,sync) / opt/benet 192.168.200.0Universe 24 (rw) Sync) / / enter: wq save and exit [root@localhost ~] # cd / opt/ [root@localhost opt] # mkdir benet accp [root@localhost opt] # chmod 777 accp/ benet/ upgrade permissions [root@localhost opt] # exportfs-rv / / to publish exporting 192.168.200.0/24:/opt/benetexporting 192.168.200.0/24:/opt/accpexporting *: / usr/share node Operation on the server (CentOS 7-2): [root@localhost ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33BOOTPROTO= "static" / / change dhcp to staticDEVICE= "ens33" ONBOOT= "yes" IPADDR=192.168.200.110 / / insert: IP under the last line Subnet Enter: wq save and exit [root@localhost ~] # service network restart Restarting network (via systemctl): [OK] [root@localhost ~] # systemctl stop firewalld.service [root@localhost ~] # setenforce 0 [root@localhost ~] # systemctl start httpd.service [root@localhost ~] # netstat-ntap | grep 80 tcp6 00: 80:: * LISTEN 7315/httpd / / set the network adapter to host [root@localhost ~] # ping 192.168.200.130PING 192.168.200.130 (192.168.200.130) 56 (84) bytes of data.64 bytes from 192.168.200.130: icmp_seq=1 ttl=64 time=0.754 ms64 bytes from 192.168.200.130: icmp_seq=2 ttl=64 time=0.368 ms64 Bytes from 192.168.200.130: icmp_seq=3 ttl=64 time=0.398 ms [root@localhost ~] # showmount-e 192.168.200.130Export list for 192.168.200.130:/usr/share * / opt/benet 192.168.200.0/24/opt/accp 192.168.200.0Compact 24 [root@localhost ~] # mount.nfs 192.168.200.130:/opt/accp / var/www/html/ mount [root@localhost ~] # Cd / var/www/html/ [root@localhost html] # echo "this is accp web" > index.html / / write home page content
At this point, go back to the storage server CentOS 7-4 to see if this file is available:
[root@localhost ~] # cd / opt/ [root@localhost opt] # lsaccp benet rh [root@localhost opt] # cd accp/ [root@localhost accp] # lsindex.html [root@localhost accp] # cat index.html this is accp web// has our new index.html file at this time
At this point, use the Firefox browser on the CentOS 7-2 node server to enter: 127.0.0.1 to see if the web page content we wrote can be displayed:
Operation on the node server (CentOS 7-3): [root@localhost ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33BOOTPROTO= "static" / / change dhcp to staticDEVICE= "ens33" ONBOOT= "yes" IPADDR=192.168.200.120 / / insert: IP, subnet under the last line Enter: wq save and exit [root@localhost ~] # service network restart Restarting network (via systemctl): [OK] [root@localhost ~] # systemctl stop firewalld.service [root@localhost ~] # setenforce 0 [root@localhost ~] # systemctl start httpd.service [root@localhost ~] # netstat-ntap | grep 80 tcp6 00: : 80: * LISTEN 7315/httpd / / set the network adapter to host-only [root@localhost ~] # ping 192.168.200.130PING 192.168.200.130 (192.168.200.130) 56 (84) bytes of data.64 bytes from 192.168.200.130: icmp_seq=1 ttl=64 time=0.532 ms64 bytes from 192.168.200.130: icmp_seq=2 ttl=64 time=1.01 ms64 bytes from 192.168.200.130: icmp_seq=3 ttl=64 time=0.940 ms [root@localhost ~] # showmount-e 192.168.200.130Export list for 192.168.200.130:/usr/share * / opt/benet 192.168.200.0/24/opt/accp 192.168.200.0Accord 24 [root@localhost ~] # mount.nfs 192.168.200.130:/opt/benet / var/www/html/ [root@localhost ~] # cd / var/www/html/ [root @ localhost html] # echo "this is benet web" > index.html
At this point, go back to the storage server CentOS 7-4 to see if this file is available:
[root@localhost ~] # cd / opt/ [root@localhost opt] # lsaccp benet rh [root@localhost opt] # cd accp/ [root@localhost accp] # lsindex.html [root@localhost accp] # cat index.html this is benet web// at this time we have our new index.html file verification: use Firefox on CentOS 7-3 node server to enter: 127.0.0.1 to see if we can display the web content we wrote.
Scheduling, operation of gateway server CentOS 7-1: [root@localhost ~] # cd / etc/sysconfig/network-scripts/ [root@localhost network-scripts] # cp ifcfg-ens33 ifcfg-ens36 [root@localhost network-scripts] # vim ifcfg-ens36BOOTPROTO= "static" / / change dhcp to staticNAME= "ens36" / / change name to ens36UUID number delete DEVICE= "ens36" / / change name to ens36ONBOOT= "yes" IPADDR=12.0.0.1 / / insert: IP under the last line Enter: wq save exit [root@localhost network-scripts] # vim ifcfg-ens33BOOTPROTO= "static" / / change dhcp to staticDEVICE= "ens33" ONBOOT= "yes" / / insert: IP under the last line after the subnet NETMASK=255.255.255.0// modification is completed After the subnet IPADDR=192.168.200.1NETMASK=255.255.255.0// modification is completed, enter: wq save exit [root@localhost network-scripts] # service network restart Restarting network (via systemctl): [OK] [root@localhost network-scripts] # vim / etc/sysctl.conf / / press o on the last line to insert net.ipv4.ip_forward=1// after modification is completed, enter: wq save exit [ Root@localhost network-scripts] # sysctl-pnet.ipv4.ip_forward = 1 [root@localhost network-scripts] # iptables-t nat-F [root@localhost network-scripts] # iptables-F [root@localhost network-scripts] # iptables-t nat-A POSTROUTING-o ens36-s 192.168.200.0Universe 24-j SNAT-- to-source 12.0.0.1win7-1 verify forwarding: first set the network card to host-only mode The Nic is configured with a static address and the firewall is turned off:
Load the LVS kernel module: [root@localhost network-scripts] # modprobe ip_ vs [root @ localhost network-scripts] # cat / proc/net/ip_vsIP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags-> RemoteAddress:Port Forward Weight ActiveConn InActConn startup service: (note: in CentOS 7, you must first save in the startup service, otherwise an error will be reported! ) [root@localhost network-scripts] # ipvsadm-- save > / etc/sysconfig/ipvsadm [root@localhost network-scripts] # systemctl start ipvsadm.service Writing configuration rules: [root@localhost network-scripts] # cd / opt/ [root@localhost opt] # vim nat.shrunk / / clear all records in the kernel virtual server table ipvsadm-A-t 12.0.0.1 ipvsadm-s rr / / Add a new virtual server ipvsadm-a-t 12.0.0.1 ipvsadm 80-r 192.168.200.110 mipvsadm// 80-mipvsadm-a-t 12.0.0.1 mipvsadm// input: wq save exit [root@localhost opt] # source nat.shIP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags-> RemoteAddress:Port Forward Weight ActiveConn InActConnTCP localhost.localdomain:http rr-> 129.168.200.110:http Masq 100-> 129.168.200.120:http Masq 100 Authentication: access 12.0.0.1 using win7-1 client terminal See if it can be successful:
Can be accessed at this time, indicating that the LVS load balancer cluster successfully provides services, and the experiment is successful!
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.