当前位置:网站首页>Kept dual machine hot standby
Kept dual machine hot standby
2022-07-26 08:41:00 【For whom do the stars change】
1、 Realization keepalived+LVS-DR Highly available load balancing web to cluster around
keepalived The role of :
Support for automatic fail over
Support node health status check

2、keepalived Installation and configuration ( In the main 、 On the backup server )
yum -y install keepalived ipvsadm
systemctl enable keepalived ( Boot from boot )
Modify kernel parameter file , close ICMP Redirect
vim /etc/sysctl.conf
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.ens33.send_redirects = 0
sysctl -pmaster server keepalived.conf Configuration of
vim /etc/keepalived/keepalived.conf
( The following is the modification )
router_id LVS_DEVEL1 ( This router ( The server ) The name of )
state MASTER ( Hot standby state ,MASTER Represents the primary server )
interface ens33 ( bearing VIP Physical interface of address )
virtual_router_id 51 ( Virtual router ID Number , Each hot standby group is consistent )
priority 100 ( priority , The higher the value, the higher the priority )
virtual_ipaddress {
200.0.0.100 ( Specify the drift address , There can be multiple )
}
virtual_server 200.0.0.100 80 { ( Virtual server address ((ViP)、 port )
delay_loop 15 ( Intervals between health checks ( second ))
lb_algo rr ( polling (rr) Scheduling algorithm )
lb_kind DR ( Direct routing ((DR) Cluster working mode )
nat_mask 255.255.255.0
! persistence_timeout 50 ( Connection retention time ( second ), If enabled, please remove it ! Number )
protocol TCP
real_server 200.0.0.4 80 { ( the second Web The address of the node )
weight 1
TCP_CHECK {
connect_port 80
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 200.0.0.4 80 { ( Third Web The address of the node )
weight 1
TCP_CHECK {
connect_port 80
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
Backup server keepalived.conf Configuration of
vim /etc/keepalived/keepalived.conf
router_id LVS_DEVEL2
vrrp_instance VI_1 {
state BACKUP
interface ens33
virtual_router_id 51
priority 90
Other configurations are the same as the main service Start the service
systemctl start keepalived
systemctl enable keepalived
3、web1 and web2 Server configuration
ifcfg-lo:0 Configure cluster ip Address 200.0.0.100, The subnet mask is 255.255.255.255
cd /etc/sysconfig/network-scripts
cp ifcfg-lo ifcfg-lo:0
vim ifcfg-lo:0
DEVICE=lo:0
IPADDR=200.0.0.100
NETMASK=255.255.255.255
ONBOOT=yes
ifup lo:0
vim /etc/rc.local
/sbin/route add -host 200.0.0.100 dev lo:0
route add -host 200.0.0.100 dev lo:0Close the part ARP The reply
vim /etc/sysctl.conf
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 -pinstall HTTP Create a test page
yum -y install httpd
vim /var/www/html/index.html
<h1>1111111<h1> (web1 To configure )
<h1>2222222<h1> (web2 To configure )
systemctl restart httpd
systemctl enable httpd
边栏推荐
- Poor English, Oracle OCP or MySQL OCP exam can also get a high score of 80 points
- Kotlin中room数据库的使用
- Super nice navigation page (static page)
- Oracle 19C OCP 1z0-082 certification examination question bank (7-12)
- 03异常处理,状态保持,请求钩子---04大型项目结构与蓝图
- 22-07-12 personal training match 1 competition experience
- Why reserve a capacitor station on the clock output?
- shell编程
- [GUI] GUI programming; AWT package (interface properties, layout management, event monitoring)
- IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!
猜你喜欢

keepalived双机热备

After MySQL 8 OCP (1z0-908), hand in your homework

Leetcode and query question summary

Using the primitive root of module m to judge and solve

QT note 2

2022-7-5 personal qualifying 2 competition experience

Memory management based on C language - Simulation of dynamic partition allocation

Shell programming

Kotlin data type

In the first year of L2, the upgrade of arbitrum nitro brought a more compatible and efficient development experience
随机推荐
Oracle 19C OCP 1z0-082 certification examination question bank (7-12)
How to safely delete a useless activity in Android studio
After MySQL 8 OCP (1z0-908), hand in your homework
Uninstallation of dual systems
Why reserve a capacitor station on the clock output?
Flutter text is left aligned with no blank space in the middle
Memory management - dynamic partition allocation simulation
2022-7-5 personal qualifying 2 competition experience
Kotlin operator
Nodejs2day(nodejs的模块化,npm下载包,模块加载机制)
Oracle 19C OCP 1z0-083 question bank (7-12)
Write common API tools swagger and redoc
Does flinkcdc now support sqlserver instance name connection?
MySQL 8.0 OCP (1z0-908) has a Chinese exam
import error: ‘Icon‘ is not exported from ‘antd‘. Import icon error
内存管理-动态分区分配方式模拟
【C语言】程序员筑基功法——《函数栈帧的创建与销毁》
为什么要在时钟输出上预留电容的工位?
JS tool function Encyclopedia
Seq2seq and attention model learning notes