Nginx load balancer how to deploy dual-computer hot standby methods and steps
The following brings you nginx Load Balancer how to deploy dual hot standby methods and steps, hoping to bring you some help in practical application, Load Balancer involves many things, theory is not much, there are many books on the Internet, today we will use the accumulated experience in the industry to do an answer.
deployment
ip allocation nginx192.168.1.5 host 192.168.1.6 standby floating ip192.168.1.7
Set floating ip first (both active and standby machines need to be set)
Open the network card eth0 and configure the network parameters
Copy eth0 to eth0:1
modified vim eth0:1
NAME = eth0:1
DEVICE = eth0:1
IPADDR = 192.168.1.7
Turn on forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
Modify the/etc/sysctl.conf file so that packet forwarding takes effect automatically at system startup:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
restart the network
service network restart
Install keepalived
yum install keepalived -y
modify the configuration file
vim /etc/keepalived/keepalived.conf
Host configuration
global_defs {
notification_email {
#baojing@163.com Set alarm
}
router_id LVS_DEVEL
}
vrrp_script chk_http_port {
script "