当前位置:网站首页>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
边栏推荐
- 12306 ticket system crawling - 1. Saving and reading of city code data
- The data read by Flink Oracle CDC is always null. Do you know
- Spark SQL common date functions
- Fluent uses protobuf
- Poor English, Oracle OCP or MySQL OCP exam can also get a high score of 80 points
- C#入门系列(三十一) -- 运算符重载
- After MySQL 8 OCP (1z0-908), hand in your homework
- QSS add resource file of QT
- [time complexity, space complexity]
- [GUI] swing package (window, pop-up window, label, panel, button, list, text box)
猜你喜欢
![[C language] programmer's basic skill method -](/img/0e/e9111d4b341cc42aa4382b5fbd0001.png)
[C language] programmer's basic skill method - "creation and destruction of function stack frames"

Super nice navigation page (static page)

【FreeSwitch开发实践】自定义模块创建与使用

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

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

OA项目之我的会议(会议排座&送审)

Kotlin variables and constants

Sub Chocolate & paint area

2022-7-7 personal qualifying 4 competition experience

Mycat2 deploy master-slave MariaDB
随机推荐
[time complexity, space complexity]
【加密周报】加密市场有所回温?寒冬仍未解冻 盘点上周加密市场发生的重大事件
Write common API tools swagger and redoc
基于C语言的哈夫曼转化软件
Why reserve a capacitor station on the clock output?
NLP (natural language processing) natural language processing learning
Transfer guide printing system based on C language design
How to safely delete a useless activity in Android studio
Kotlin function
Redis advanced
Fluent uses protobuf
2022-7-8 personal qualifying 5 competition experience (supplementary)
23.5 event listeners of application events and listeners
【C语言】程序员筑基功法——《函数栈帧的创建与销毁》
File management file system based on C #
Mysql8 one master one slave +mycat2 read write separation
Super potential public chain dfinity -- the best time for DFI developers to enter
03异常处理,状态保持,请求钩子---04大型项目结构与蓝图
B title: razlika priority queue approach
基于C语言的内存管理-动态分区分配方式模拟