当前位置:网站首页>Keepalived 设置不抢占资源
Keepalived 设置不抢占资源
2022-07-03 17:47:00 【星哥玩云】
keepalived做HA时,经常会遇到抢占式的master和backup之间的切换
example:
通常如果master服务死掉后backup会变成master,但是当master服务又好了的时候 master此时会抢占VIP,这样就会发生两次切换对业务繁忙的网站来说是不好的。所以我们要在配置文件加入 nopreempt 非抢占,但是这个参数只能用于state 为backup,故我们在用HA的时候最好master 和backup的state都设置成backup 让其通过priority来竞争。
注意:这样配置后,我们要注意启动keepalived服务的顺序,假设我想让A成为backup那就不能先启动A的keepalived服务。
以下是结合MHA架构主、备库配置事例
主库
[[email protected] ~]# more /etc/keepalived/keepalived.conf #20140916 #!/bin/bash
global_defs { router_id mysqlmha }
vrrp_script check_run { script "/etc/keepalived/check_mysql.sh" interval 1 }
vrrp_instance VI_1 { state BACKUP --这里状态指定为backup interface eth0 virtual_router_id 151 priority 100 advert_int 1 nopreempt --设置 nopreempt 防止抢占资源 authentication { auth_type PASS auth_pass 1111 }
track_script { check_run } virtual_ipaddress { 192.168.66.53 } }
备库
[[email protected] ~]# more /etc/keepalived/keepalived.conf ! Configuration File for keepalived
global_defs { router_id mysqlmha }
vrrp_script check_run { script "/etc/keepalived/check_mysql.sh" interval 1 }
vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 151 priority 90 advert_int 1 authentication { auth_type PASS auth_pass 1111 }
track_script { check_run }
virtual_ipaddress { 192.168.66.53 } }
边栏推荐
- Research on Swift
- STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
- UE4 official charging resources, with a total price of several thousand
- Stm32h7 Hal library SPI DMA transmission has been in busy solution
- 1164 Good in C
- How to deploy applications on kubernetes cluster
- Test your trained model
- IntelliJ 2021.3 short command line when running applications
- Qt调节Win屏幕亮度和声音大小
- [combinatorics] recursive equation (special solution form | special solution solving method | special solution example)
猜你喜欢
1147_ Makefile learning_ Target files and dependent files in makefile
[RT thread] NXP rt10xx device driver framework -- RTC construction and use
Introduction to SolidWorks gear design software tool geartrax
Research Report on investment trends and development planning of China's thermal insulation material industry, 2022-2028
Records of long objects and long judgments in the stream of list
Hongmeng fourth training
TCP congestion control details | 3 design space
vs2013已阻止安装程序,需安装IE10
Getting started with deops
Micro service component sentinel console call
随机推荐
IntelliJ 2021.3 short command line when running applications
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
聊聊支付流程的設計與實現邏輯
聊聊支付流程的设计与实现逻辑
TCP congestion control details | 3 design space
微服务组件Sentinel控制台调用
AcWing 4489. Longest subsequence
[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework
Interviewer: why is the value nil not equal to nil?
Select 3 fcpx plug-ins. Come and see if you like them
Investigation on the operation prospect of the global and Chinese Anti enkephalinase market and analysis report on the investment strategy of the 14th five year plan 2022-2028
STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
Leetcode 669 pruning binary search tree -- recursive method and iterative method
vs2013已阻止安装程序,需安装IE10
Type conversion, variable
POM in idea XML graying solution
[combinatorics] recursive equation (four cases where the non-homogeneous part of a linear non-homogeneous recursive equation with constant coefficients is the general solution of the combination of po
Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
Notes on problems -- watching videos on edge will make the screen green
Play with fancy special effects. This AE super kit is for you