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 > Servers >
Share
Shulou(Shulou.com)06/02 Report--
LVS cluster
Type of cluster:
Load balancing cluster: improve the responsiveness of applications with the goal of reducing latency and achieving overall performance with high concurrency and high load.
High availability cluster: improve the reliability of the application system, reduce interruption as much as possible, ensure the continuity of service, and achieve the effect of high availability fault tolerance.
High-performance computing cluster: improve the CPU computing speed of the application system, and obtain high-performance computing power equivalent to large-scale, supercomputing.
Hierarchical structure of load balancing cluster: load scheduler, server pool, shared storage.
Working mode of load balancing:
Address translation mode: NAT, the load scheduler acts as the gateway of all server nodes, that is, as the access entrance of the client, but also the access exit of each node responding to the client. The server node uses a private IP address, which is located on the same physical network as the load balancer.
Direct routing mode: DR, using a semi-open network structure, the server and the scheduler are located in the same physical network.
IP tunnel mode: TUN, using an open network structure, the load scheduler only serves as the access entrance for the client, and each node will directly use the client through its own internet connection, instead of going through the load balancing scheduler.
LVS virtual server is a load balancing project developed for Linux kernel. LVS is a part of linux kernel, which is compiled into ip_vs module by default and uses management ipvsadm management tools.
Load scheduling algorithm of LVS:
Polling: assigns received access requests sequentially to each node in the cluster.
Weighted polling: rotationally assigned to each node in the cluster based on the processing power of the real server.
Minimum connections: allocated according to the number of connections established by the real server.
Weighted least connections: the weights are automatically adjusted for the real server, and the nodes with higher weights bear a greater proportion of active connections.
Direct routing LVS-DR deployment:
V configure scheduling server:
# iptables-F turn off the firewall
# setenfoece 0
# modprobe ip_vs loading IP_vs module
# yum-y install ipvsadm install ipvs management tools
# ifconfig eth0:0 1.1.1.100amp 32 to create a loopback virtual IP
# route add-host 1.1.1.100 dev eth0:0 create a virtual IP route
# service ipvsadm stop is clear about ipvsadm policy
# ipvsadm-A-t 1.1.1.100 80-s rr to create a virtual server
# ipvsadm-a-t 1.1.1.100 80-r 1.1.1.1 VR 80-g-w 1 create an ipvsadm policy
# ipvsadm-a-t 1.1.1.100VR 80-r 1.1.1.2 Rd 80-g-w 1
# service ipvsadm save Save Policy
V configure node server:
# iptables-F
# setenforce 0 turn off the firewall
# ifconfig lo:0 1.1.1.100 ifconfig lo:0 32 create a virtual IP
# route add-host 1.1.1.100 dev lo:0 create a virtual IP route
# vim / etc/sysctl.conf disables ARP parsing
Modify the content:
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
# sysctl-p
# service httpd restart
V configure node server:
# iptables-F turn off the firewall
# setenforce 0
# ifconfig lo:0 1.1.1.100 ifconfig lo:0 32 create a virtual IP
# route add-host 1.1.1.100 dev lo:0 create a virtual IP route
# vim / etc/sysctl.conf disables ARP parsing
Modify the content:
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
# sysctl-p
# service httpd restart
Address Translation LVS-NAT deployment:
V configure the load scheduler:
# vim / etc/sysctl.conf
Modify the content:
Net.ipv4.ip_forword = 1 turn on the routing switch
# sysctl-p
# iptables-t nat-A POSTROUTING-s 1.1.1.0 NAT 24-o eth0-j SNAT-- to-source 1.1.1.100 NAT conversion
# service ipvsadm stop clear ipvsadm Policy
# ipvsadm-A-t 1.1.1.100 80-s rr to create a virtual server
# ipvsadm-a-t 1.1.1.100 80-r 1.1.1.1 VR 80-m-w 1 create an ipvsadm policy
# ipvsadm-a-t 1.1.1.100VR 80-r 1.1.1.2 Rd 80-m-w 1
# service ipvsadm save
V-node server only needs to enable web service:
# service httpd restart
Summary of ipvsadm command options
A
Means to add a virtual server
-t
Indicates the use of TCP protocol
S
Algorithms that represent specified load scheduling: polling (rr), weighted polling (wrr), least join (lc), weighted least join (wlc)
-a
Means to add a server node
-r
Represents the real server address
-m
Indicates that NAT cluster mode is used
-g
Indicates that DR cluster mode is used
-I
Indicates the use of TUN cluster mode
-w
Represent weight
-ln
View ipvsadm node status
-C
Make clear the ipvsadm strategy
-d
Means to delete a server node
Create a virtual server command format:
Ipvsadm-A-t virtual address: Port-s scheduling algorithm
Example: ipvsadm-A-t 1.1.1.100 ipvsadm 80-s rr
Create an ipvsadm policy:
Ipvsadm-a-t virtual address: Port-r real address: Port cluster mode-w weight value
For example: ipvsadm-a-t 1.1.1.100 80-r 1.1.1.1 VR 80-m-w 1
Note:
Permanently modify the virtual IP:
Vim / etc/sysconfig/netwrok-scripts/ifcfg-lo:0
The contents are as follows:
DEVICE=lo:0
ONBOOT=yes
IPADDR=1.1.1.1
NETMASK=255.255.255.255
Permanently modify routing method 1:
Vim / etc/rc.local
Add content:
/ sbin/route add-host 1.1.1.1 dev lo:0
Permanently modify routing method 2:
Vim / etc/sysconfig/networking/static-route
Add content:
Any-host 1.1.1.1 dev lo:0
Think about:
Why should the node server turn off ARP parsing?
Answer: when the scheduling server and the node server use the same IP, the visitor sends an ARP request, so if the node server responds, the access will not go through the scheduling server.
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
5G Next Generation of Communication
© 2024 shulou.com SLNews company. All rights reserved.