NAT technology will request packets and response packets need to be rewritten by LB address, site visits and therefore a greater amount of time LB load balancing scheduler relatively large bottleneck, generally require a maximum of 10-20 sets of nodes
Cons: Delayed
Tunneling (VS / TUN mode)
Workload scheduler accepts client requests packet to a real server (IP tunneling), the real server returns the response directly to the client, so that only the scheduler processing request packet, reducing the scheduler.
Direct routing (VS / DR mode)
With tunnel-like manner, except that the scheduler transmits the data to the RS is forwarding the MAC address
Scheduling:
Sequentially circulating manner scheduling request to a different server
The average assigned to each server
Weighted round-robin: WRR
Adding to the server for each value, the higher the weight the more data processing
Minimum connection scheduling: LC
The latest allocation requests to the minimum number of connections the server is a Dynamic Scheduling Algorithm
Weighted Minimum Link Scheduling: WLC
The performance of setting weights for each server, the server may make the established value proportional to the number of connections and their weights. Queries scheduler may automatically load the real server, and dynamically adjusts the weight.
Based on partial least connections: LBLC
First find server ip address this request recently used, if the server is available and there is no overloading, the request will be sent to the server if the server does not exist or is overloaded accordance with the "least connections (LC)" principle to send the request to an available server
Locality-based band replication least connected: LBLC
It is different with LBLC algorithm is that it wants to maintain the mapping from a target IP address to a group of servers, and LBLC algorithm maintains a mapping from a target IP address to a server. Press 'minimum connection' principle selected from eleven servers in the server group, if the server is not overloaded, send a request to the server; if the server is overloaded, press 'minimum connection' a principle selected from the entire server cluster the server is then added to the server group, sends a request to the server. Meanwhile, when the server group for some time not been modified, the busiest server is removed from the server group, in order to reduce the degree of replication.
Destination address hashing scheduling (HD)
First algorithm based on the target IP address request, as the hash key (Hash Key) to find the corresponding server from the list bulk static allocation, if the server is available and not overloaded, the request is sent to the server, otherwise empty .
Scheduling the source address hash (SH)
And destination address hashing scheduling (HD) substantially similar
The shortest expected delay (SED)
Each server has a weight value, the calculation result is sent to the server by a minimum operator will request
Minimum queue scheduling (NQ)
Algorithm, no queues. If the number of connections is equal to 0 realserver directly assigned past, no operation is performed SED.
Original Address: https: //www.cnblogs.com/f-ck-need-u/p/8451982.html
keepalived is a similar layer3, software switching mechanism 4 & 7. Used herein to detect the state of a web server , if there is a web server crashes, or work fails , Keepalived detected, and there is a failure of the system removed from the web server , the web server when working the normal Keepalived web server automatically added to the server farm , the work all done automatically, without human intervention, the need to manually do is repair the fault of the web server.
Detection:
Work IP, TCP, the application layer (network layer, the transport layer, application layer)
VRRP (hot standby):
When there are two or more scheduler, keeplived can set the priority, with access through a virtual ip, if the scheduler is down, keepalived will use an alternate scheduler.
As illustrated, if the master server is down, the standby server will use slava
experiment:
There are three machines
172.16.13.110
172.16.13.111
172.16.13.112
The following step is the portion 2-7 on director (172.16.13.110)
keepalived
by
systemctl stop firewalld
setenforce 0
See, this time is off
The best test firewall and selinux mechanism to turn off all hosts
After a good test and then open the firewall, open the appropriate services and ports
/etc/keepalived/keepalived.conf
as follows:
! Configuration File for keepalived
global_defs {
notification_email {
[email protected]
[email protected]
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface ens33
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
172.16.13.119
}
}
virtual_server 172.16.13.119 80 {
delay_loop 6
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP
real_server 172.16.13.111 80 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
}
Note: keepalived newly installed there may be a few words, you need to delete
Otherwise, the outside can not access
ip conflict will go wrong
problem:
Restart keepalivd will close the card, that is, the IP address is not
Keepalived first restart to restart the network card ip will become a virtual IP, but can not be accessed via a virtual ip172.16.13.119
Reboot your card and then restart keepalivd which can not pass outside the virtual ip access
reference:
It should be noted:
It is 127.0.0.1
NIC card is his name computer where the virtual machine is ens33
This specifies the virtual ip
Here virtual server settings under the ip ip
Modify the file /etc/sysctl.conf
Detection:
Restart network services
Start ens33 card
Start keepalived Service
Was originally turned on or off certain services, shut down is chkconfig keepalived off
In centos7 performs a power on command from the start, or use systemctl enable keepalived
Start the service:
systemctl start keepalived
Start ipvsadm
The first time you start if an error execute the following command:
ipvsadm --save > /etc/sysconfig/ipvsadm
ps afx|grep keepalived
View the process is running keepalived
ip a
View vip (virtual address) 172.16.13.119 there is no longer the master
Note: ens33 the inet do not own before then keepalivad inside If, after ip a virtual IP address to restart the network service, and then restart the card, and then after the execution will be the ip a
ipvsadm –ln
This command is used to see which web services on the real server is enabled.
8- steps on the real server (172.16.13.111)
yum –y install nginx
After you install the service and open access to the home page to check if successful
Note installed nginx access the home page, you may not have access to the home page but centos nginx homepage
As shown below:
#!/bin/bash
VIP=172.16.13.119
case $1 in
start)
echo "Start LVS of DS"
ifconfig lo:0 $VIP netmask 255.255.255.255 broadcast $VIP
route add -host $VIP dev lo:0
echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce
sysctl -p > /dev/null 2>&1
;;
stop)
echo "Stop LVS of DR"
ifconfig lo:0 down
route del $VIP>/dev/null 2>&1
echo "0" > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "0" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "0" > /proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage:$0 {start|stop}"
;;
esac
edit permission
This file function is to VIP (virtual address) registered on the machine lo.0 card
service appserver start
Equivalent startup scripts, start the service can be understood as
You can also set the boot
11 view
It has been generated virtual network card
12, the test:
Note: If the test done later, must pay attention to the service startup sequence, this may cause the test fails, if the implementation of ip a ens33 not have to restart the network card - Restart ipvsadm-- restart keepalived
Start the service you need to start network services, and then start the service keepalived
In this way, to build a director and real server
Configuring two master director even hung up can also be accessed through salve
(Master and the salve see figure)