Files

94 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2026-11-15 10:05:34 +01:00
## DNS enteries:
```text
ivera-db1 IN A 192.168.0.109
ivera-db2 IN A 192.168.0.110
ivera-db-vip IN A 192.168.0.115
```
## Master node
File `docker-compose.yml`:
```yml
services:
keepalived:
image: osixia/keepalived:latest
container_name: keepalived-master
restart: unless-stopped
network_mode: host
cap_add:
- NET_ADMIN
- NET_RAW
- NET_BROADCAST
volumes:
- ./keepalived.conf:/etc/keepalived/keepalived.conf:ro
```
File `keepalived.conf`:
```text
vrrp_instance VI_1 {
state MASTER
interface enp1s0
virtual_router_id 51
priority 100
advert_int 1
unicast_src_ip 192.168.0.109 # Replace with Master node's actual IP
unicast_peer {
192.168.0.110 # Replace with Backup node's actual IP
}
authentication {
auth_type PASS
auth_pass secret
}
virtual_ipaddress {
192.168.0.115/24 # The shared Virtual IP (VIP)
}
}
```
## Backup node
File `docker-compose.yml`:
```yml
services:
keepalived:
image: osixia/keepalived:latest
container_name: keepalived-backup
restart: unless-stopped
network_mode: host
cap_add:
- NET_ADMIN
- NET_RAW
- NET_BROADCAST
volumes:
- ./keepalived.conf:/etc/keepalived/keepalived.conf:ro
```
File `keepalived.conf`:
```text
vrrp_instance VI_1 {
state BACKUP
interface enp1s0
virtual_router_id 51
priority 90
advert_int 1
unicast_src_ip 192.168.0.110 # Replace with Backup node's actual IP
unicast_peer {
192.168.0.109 # Replace with Master node's actual IP
}
authentication {
auth_type PASS
auth_pass secret
}
virtual_ipaddress {
192.168.0.115/24 # The shared Virtual IP (VIP)
}
}
```