gautam-shrestha.com.np
Page | 3
3. Configure Keepalived and Enable Keepalived on both nodes
Once installed, you need to configure Keepalived on each node. Keepalived uses a
configuration file (keepalived.conf) to define its behavior. Edit the Keepalived
configuration file (/etc/keepalived/keepalived.conf).
sudo nano /etc/keepalived/keepalived.conf
For nginx1: (Click here! for code)
Here,
vrrp_instance VI_1: Defines a VRRP instance with the name VI_1.
state: Specifies whether the node is MASTER or BACKUP.
interface: Network interface where VRRP packets will be sent and received.
virtual_router_id: A unique identifier for the VRRP instance.
priority: Priority of the node; higher priority nodes become MASTER.
advert_int: Advertisement interval (how often the nodes send VRRP advertisements).
unicast_src_ip: Specifies the source IP address that Keepalived will use for sending
VRRP unicast packets. This is typically set to an IP address of the current node.
unicast_peer: Lists the IP addresses of the peer nodes that will receive the VRRP
unicast packets. These are the addresses of the other nodes participating in the VRRP
setup.
authentication: Authentication settings (auth_type and auth_pass).
virtual_ipaddress: Virtual IP address associated with this VRRP instance.