当前位置:网站首页>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
边栏推荐
- 基于C语言的哈夫曼转化软件
- Foundry tutorial: writing scalable smart contracts in various ways (Part 1)
- [untitled]
- Oracle 19C OCP 1z0-082 certification examination question bank (30-35)
- The data read by Flink Oracle CDC is always null. Do you know
- Mysql database connection / query index and other common syntax
- Status management bloc provider geTx
- Excel find duplicate lines
- Add in the registry right click to open in vscode
- QT note 1
猜你喜欢

MySQL 8.0 OCP (1z0-908) has a Chinese exam
![[time complexity, space complexity]](/img/f2/f82c7e0a6ab9f893023c2ddbac3431.png)
[time complexity, space complexity]

Winter vacation homework & Stamp cutting

Foundry教程:使用多种方式编写可升级的智能合约(上)

Huffman transformation software based on C language

Kotlin program control

QT note 1

Poor English, Oracle OCP or MySQL OCP exam can also get a high score of 80 points

Sub Chocolate & paint area

CV learning notes (optical flow)
随机推荐
Oracle 19C OCP 1z0-082 certification examination question bank (13-18)
内存管理-动态分区分配方式模拟
flink oracle cdc 读取数据一直为null,有大佬知道么
Web3 Games: current situation and future
Xshell batch send command to multiple sessions
【FreeSwitch开发实践】使用SIP客户端Yate连接FreeSwitch进行VoIP通话
Excel delete blank lines
JS tool function Encyclopedia
解决C#跨线程调用窗体控件的问题
Oracle 19C OCP 1z0-082 certification examination question bank (42-50)
QT note 1
Mysql database connection / query index and other common syntax
Oracle 19C OCP 1z0-082 certification examination question bank (30-35)
Flutter compilation fails
Nodejs2day(nodejs的模块化,npm下载包,模块加载机制)
6、 Pinda general permission system__ pd-tools-log
Super potential public chain dfinity -- the best time for DFI developers to enter
Use index to optimize SQL query "suggestions collection"
23.2 customizing the banner control display hidden banner modify banner
1、 Redis data structure