keepalived HA

keepalived

https://www.keepalived.org/download.html

1
2
❯ ./configure --prefix=/opt/keepalived/2.3.1
❯ make install >& /opt/keepalived/log &

*** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.

sudo apt-get install build-essential libnl-3-dev libnl-route-3-dev check libssl-dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
vrrp_script chk_mysql_alived {
script "/usr/local/scripts/chk_mysql_alived.sh"
interval 2
weight -10
}

vrrp_instance VI_1 {
state MASTER
interface ens33 # 请根据您的实际网络接口进行调整
virtual_router_id 50 #与从库的要一致
priority 101 # 较高的优先级,确保主服务器始终是 MASTER
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.228.112 # 虚拟 IP 地址
}
track_script {
chk_mysql_alived
}
vrrp_log {
file /var/log/keepalived.log # 日志文件的位置
syslog yes # 启用系统日志输出
debug yes # 详细调试日志(根据需要调整)
daemon_notice yes # 记录守护进程通知
}
}

点击打赏
文章目录
  1. 1. keepalived
  2. 2.
载入天数...载入时分秒... ,