Re: Keepalived setting both nodes as master

Quentin Armitage <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Organization The Armitage family
Message-ID <[email protected]>
On Thu, 2016-12-22 at 18:08 +0530, Kaushal Shriyan wrote:
> Hi,
> 
> 
> 
> I am running keepalived 1.3.2 on CentOS 6.8. I am setting up HA load
> balancer HAProxy setup. My configs are as below
> 
> 

It appears that the backup server isn't seeing the VRRP packets from the
master server. The master is seeing the backup servers packets, but the
backup isn't seeing the packets from the master. This can often be down
to iptables configuration either not allowing the master to send
packets, or not allowing the backup to receive packets.

I also note that the vrrp_script on the master server does not appear to
be returning successfully, since the priority isn't being increased from
200 to 202.

It further appears that the vrrp_scripts will not achieve anything. The
priorities of the "master" server will be either 200 or 202, and the
priorities of the "backup" server will be 100 or 102, so the backup will
always be a lower priority than the master. If you want the backup to
take over when haproxy is not running on the "master", then the priority
of the backup needs to be higher than the master when haproxy is not
running on the master, so you could have a weight -101 on the master so
its priority reduces to 99 if haproxy is not running.

I hope that helps,

Quentin Armitage

> Master Server ----
> 
> 
> cat keepalived.conf
> global_defs {
> # Keepalived process identifier
> #lvs_id haproxy_DH
> }
> # Script used to check if HAProxy is running
> vrrp_script check_haproxy {
> script "/usr/bin/killall -0 haproxy"
> interval 2
> weight 2
> }
> # Virtual interface
> # The priority specifies the order in which the assigned interface to
> take over in a failover
> vrrp_instance VI_01 {
> state MASTER
> interface eth0
> virtual_router_id 51
> priority 200
> # The virtual ip address shared between the two loadbalancers
> virtual_ipaddress {
> 172.16.0.75/32
> }
> track_script {
> check_haproxy
> }
> }
> 
> 
> keepalived -f /etc/keepalived/keepalived.conf --dont-fork
> --log-console --log-detail
> Starting Keepalived v1.3.2 (12/21,2016)
> WARNING - default user 'keepalived_script' for script execution does
> not exist - please create.
> Opening file '/etc/keepalived/keepalived.conf'.
> Starting Healthcheck child process, pid=4198
> Starting VRRP child process, pid=4199
> Initializing ipvs
> Netlink reflector reports IP 172.16.0.20 added
> Netlink reflector reports IP fe80::feaa:14ff:fede:c50a added
> Netlink reflector reports IP 172.16.0.20 added
> Registering Kernel netlink reflector
> Registering Kernel netlink command channel
> Netlink reflector reports IP fe80::feaa:14ff:fede:c50a added
> Opening file '/etc/keepalived/keepalived.conf'.
> Registering Kernel netlink reflector
> Registering Kernel netlink command channel
> Registering gratuitous ARP shared channel
> Opening file '/etc/keepalived/keepalived.conf'.
> VRRP_Instance(VI_01) removing protocol VIPs.
> SECURITY VIOLATION - scripts are being executed but script_security
> not enabled.
> Using LinkWatch kernel netlink reflector...
> VRRP sockpool: [ifindex(2), proto(112), unicast(0), fd(10,11)]
> Using LinkWatch kernel netlink reflector...
> pid 4200 exited with status 1
> VRRP_Instance(VI_01) Transition to MASTER STATE
> VRRP_Instance(VI_01) Received advert with lower priority 102, ours
> 200, forcing new election
> pid 4202 exited with status 1
> VRRP_Instance(VI_01) Entering MASTER STATE
> VRRP_Instance(VI_01) setting protocol VIPs.
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Sending/queueing gratuitous ARPs on eth0 for
> 172.16.0.75
> Netlink reflector reports IP 172.16.0.75 added
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Received advert with lower priority 102, ours
> 200, forcing new election
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Sending/queueing gratuitous ARPs on eth0 for
> 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Received advert with lower priority 102, ours
> 200, forcing new election
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Sending/queueing gratuitous ARPs on eth0 for
> 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> pid 4204 exited with status 1
> VRRP_Instance(VI_01) Received advert with lower priority 102, ours
> 200, forcing new election
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Sending/queueing gratuitous ARPs on eth0 for
> 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Received advert with lower priority 102, ours
> 200, forcing new election
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Sending/queueing gratuitous ARPs on eth0 for
> 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> pid 4206 exited with status 1
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Sending/queueing gratuitous ARPs on eth0 for
> 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> 
> 
> 
> 
> Slave Server ----
> 
> 
> cat keepalived.conf
> global_defs {
> # Keepalived process identifier
> #lvs_id haproxy_DH_passive
> }
> # Script used to check if HAProxy is running
> vrrp_script check_haproxy {
> script "/usr/bin/killall -0 haproxy"
> interval 2
> weight 2
> }
> # Virtual interface
> # The priority specifies the order in which the assigned interface to
> take over in a failover
> vrrp_instance VI_01 {
> state BACKUP
> interface eth0
> virtual_router_id 51
> priority 100
> # The virtual ip address shared between the two loadbalancers
> virtual_ipaddress {
> 172.16.0.75/32
> }
> track_script {
> check_haproxy
> }
> }
> 
> 
> keepalived -f /etc/keepalived/keepalived.conf --dont-fork
> --log-console --log-detail
> Starting Keepalived v1.3.2 (12/21,2016)
> WARNING - default user 'keepalived_script' for script execution does
> not exist - please create.
> Opening file '/etc/keepalived/keepalived.conf'.
> Starting Healthcheck child process, pid=4979
> Starting VRRP child process, pid=4980
> Initializing ipvs
> Netlink reflector reports IP 172.16.0.21 added
> Netlink reflector reports IP fe80::feaa:14ff:fede:c509 added
> Registering Kernel netlink reflector
> Registering Kernel netlink command channel
> Netlink reflector reports IP 172.16.0.21 added
> Opening file '/etc/keepalived/keepalived.conf'.
> Netlink reflector reports IP fe80::feaa:14ff:fede:c509 added
> Registering Kernel netlink reflector
> Registering Kernel netlink command channel
> Registering gratuitous ARP shared channel
> Opening file '/etc/keepalived/keepalived.conf'.
> VRRP_Instance(VI_01) removing protocol VIPs.
> SECURITY VIOLATION - scripts are being executed but script_security
> not enabled.
> Using LinkWatch kernel netlink reflector...
> VRRP_Instance(VI_01) Entering BACKUP STATE
> VRRP sockpool: [ifindex(2), proto(112), unicast(0), fd(10,11)]
> Using LinkWatch kernel netlink reflector...
> VRRP_Script(check_haproxy) succeeded
> VRRP_Instance(VI_01) Changing effective priority from 100 to 102
> VRRP_Instance(VI_01) Transition to MASTER STATE
> VRRP_Instance(VI_01) Entering MASTER STATE
> VRRP_Instance(VI_01) setting protocol VIPs.
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Sending/queueing gratuitous ARPs on eth0 for
> 172.16.0.75
> Netlink reflector reports IP 172.16.0.75 added
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> VRRP_Instance(VI_01) Sending/queueing gratuitous ARPs on eth0 for
> 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> Sending gratuitous ARP on eth0 for 172.16.0.75
> 
> 
> Any help will be highly appreciable. Thanks in Advance. Please do let
> me know if you need any additional information.
> 
> 
> Regards,
> 
> 
> Kaushal
> 
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today.http://sdm.link/intel
> _______________________________________________ Keepalived-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/keepalived-devel

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel

_______________________________________________
Keepalived-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/keepalived-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.