Estou tentando criar o balanceador de carga usando o IP virtual. Eu indiquei este link Load Balancer usando o Virtual IP . Depois de configurar por engano, iniciei o serviço keepalived do servidor de backup primeiro e, em seguida, iniciei o keepalived do servidor master. O problema é que o keepalived do servidor de backup está funcionando bem, mas não consigo iniciar o keepalived do servidor master. Eu tentei desinstalar o keepalived e instalado novamente, mas isso não funcionou.
Aqui estão os arquivos de configuração
Servidor principal
vrrp_script chk_haproxy {
script "killall -0 haproxy" # verify the pid existance
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface eth0 # interface to monitor
state MASTER
virtual_router_id 51 # Assign one ID for this route
priority 101 # 101 on master, 100 on backup
virtual_ipaddress {
192.168.0.54 # the virtual IP
}
track_script {
chk_haproxy
}
}
Servidor de backup
vrrp_script chk_haproxy {
script "killall -0 haproxy" # verify the pid existance
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface eth0 # interface to monitor
state MASTER
virtual_router_id 51 # Assign one ID for this route
priority 100 # 101 on master, 100 on backup
virtual_ipaddress {
192.168.0.54 # the virtual IP
}
track_script {
chk_haproxy
}
}
Saída do servidor mestre ao iniciar o serviço keepalived
$ sudo service keepalived start
* Starting keepalived keepalived [fail]
Saída do servidor de backup ao iniciar o serviço keepalived
$ sudo service keepalived start
* Starting keepalived keepalived [Ok]
Alguém está sugerindo o que estou fazendo de errado aqui?
Atualize de acordo com os comentários:
Log do servidor principal:
cat /var/log/syslog | grep VRRP_Instance
Here it does not prints anything which mean that the keepalived does not start on Master server
Log dos servidores de backup:
cat /var/log/syslog | grep VRRP_Instance
Mar 27 02:39:22 ubuntu keepalived_vrrp: VRRP_Instance(VI_1) Transition to MASTER STATE
Mar 27 02:39:23 ubuntu keepalived_vrrp: VRRP_Instance(VI_1) Entering to MASTER STATE
Mar 27 02:39:38 ubuntu keepalived_vrrp: VRRP_Instance(VI_1) Transition to MASTER STATE
Mar 27 02:39:39 ubuntu keepalived_vrrp: VRRP_Instance(VI_1) Entering to MASTER STATE
Mar 27 02:52:16 ubuntu keepalived_vrrp: VRRP_Instance(VI_1) Received higher prio advert
Mar 27 02:52:16 ubuntu keepalived_vrrp: VRRP_Instance(VI_1) Entering to BACKUP STATE
Além disso, mais uma coisa depois de se referir a um site, alterei o estado no arquivo keepalived.conf do servidor de backup para o estado BACKUP