keepalived双活配置详细信息
时间: 2024-01-14 14:20:19 浏览: 132
以下是keepalived双活配置的详细信息:
1. 安装keepalived
```shell
yum install keepalived
```
2. 配置keepalived主机
- 编辑主配置文件
```shell
vi /etc/keepalived/keepalived.conf
```
- 配置主机为MASTER
```shell
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 101
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.1.1
}
}
```
3. 配置keepalived备用主机
- 编辑主配置文件
```shell
vi /etc/keepalived/keepalived.conf
```
- 配置备用主机为BACKUP
```shell
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.1.1
}
}
```
4. 配置故障通知脚本
```shell
notify_fault "/usr/local/keepalived/etc/keepalived/notify.sh fault"
```
5. 启动/停止keepalived
```shell
systemctl start keepalived
systemctl stop keepalived
```
阅读全文