Hi Joshua,

You are a bit off topic. Please ask for details with keepalived on
keepalived mailinglist.

On 04/18/13 20:42, Joshua Chee wrote:
> update:
> not very smart with http_get as haproxy is configured to RR between
> apache. Thus if 1 apache is down, it will still reflect as real server
> down, which is not how i want it, i only want it to be down only when
> all apache of the webfarm is down.
>
The just let haproxy check the apache servers and check the haproxy
servers from lvs/keepalived.
Every haproxy could have the following:
  acl backends_avail ....
  monitor-uri /haproxycheck
  monitor fail if ! backends_avail

now you can query the haproxy ones and check that /haproxycheck return
200OK.
To integrate that into keepalived you could something like

..
HTTP_GET {
    url {
        path /haproxycheck
        status_code 200
    }
    connect_timeout 10
    connect_port 80
..
in every real server.

 ==> lvs(keepalived1:) ==> NAT ==> haproxy1,haproxy2
                                              haproxy1 ==> apache1,
apache2, apache3, apache4

 ==> lvs(keepalived2:) ==> NAT haproxy1,haproxy2
                                              haproxy1 ==> apache1,
apache2, apache3, apache4

lvs, haproxy and the apache servers should run on seperate machines.

> the vrrp_script is checking if haproxy is running in process which is
> good if haproxy crashes, however would be similar to TCP_CHECK on
> haproxy(transparent proxy).
>
>
If HAProxy is running on both machines, as it is for keepalived you only
need a failover if the machines crashes.
>
> On 19 April 2013 02:26, Joshua Chee <[email protected]
> <mailto:[email protected]>> wrote:
>
>     ok able to get vrrp to detect webfarms down by http_get on vrrp,
>     however still unable to change the state or reduce the priority of
>     MASTER
>
>     global_defs {
>        notification_email {
>             [email protected] <mailto:[email protected]>
>        }
>        notification_email_from [email protected] <mailto:[email protected]>
>        smtp_server 127.0.0.1
>        smtp_connect_timeout 30
>        router_id LVS_XXXXXX
>     }
>
>     vrrp_script chk_haproxy {
>        script "killall -0 haproxy"
>        interval 2
>        weight 2
>
>     }
>
>     vrrp_instance loadbalance1 {
>         state MASTER
>         interface eth0
>         virtual_router_id 51
>         priority 101
>         advert_int 1
>         smtp_alert
>         authentication {
>             auth_type PASS
>             auth_pass somepassword
>         }
>         virtual_ipaddress {
>             192.168.88.95
>         }
>         track_script {
>              chk_haproxy
>             }
>     }
>
>     virtual_server 192.168.88.95 80 {
>         delay_loop 6
>         lb_algo rr
>         lb_kind NAT
>         nat_mask 255.255.255.0
>         persistence_timeout 50
>         protocol TCP
>
>        real_server 192.168.88.96 80 {
>             weight 1
>     #       TCP_CHECK {
>     #          connect_port 80
>     #          connect_timeout 3
>     #       }
>             HTTP_GET {
>                url {
>                     path /index.html
>                     digest a1be24adde652800a4ec1c4e129d6014
>                }
>             connect_timeout 10
>             connect_port 80
>             }
>        }
>     }
>
As far as I can see, you may have a problem with your priorities. If the
haproxy process
is not running, your new priority would be 101-2. So the other machine
should
have a priority of 100.
check this out with tcpdump -i ethx vrrp -vv

>
>     On 19 April 2013 02:02, Joshua Chee <[email protected]
>     <mailto:[email protected]>> wrote:
>
>           shared IP=192.168.88.95
>
>         |                        |
>
>         keepalived1               keepalived2
>
>         |                        |
>
>         haproxy1                  haproxy2
>
>         192.168.88.96:80 <http://192.168.88.96:80>          192.168.88.97:80 
> <http://192.168.88.97:80>
>         |                         |
>
>         |------------|            |------------|
>
>         apache1      apache2      apache3       apache4
>
>         192.168.88.96:8080 <http://192.168.88.96:8080>        
> 192.168.88.97:8080 <http://192.168.88.97:8080>
>
>                      192.168.88.96:8090 <http://192.168.88.96:8090>         
> 192.168.88.97:8090 <http://192.168.88.97:8090>
>
>
>
>         On 19 April 2013 01:42, Joshua Chee <[email protected]
>         <mailto:[email protected]>> wrote:
>
>             I am running 2VRRP and 2HA. Each VRRP is linked to 1 HA
>             and each HA is linked to 2 apache webserver.
>
>             I am only able to make the vrrp failover when i stop the
>             vrrp service, not able to do that when i stop the haproxy
>             service or stop all apache services.
>
>             Is there a way for haproxy to stop or reflect when all its
>             webfarms are down?
>
>             I am trying to run a script in vrrp as per alot of guides,
>             vrrp_script chk_haproxy{
>                script "killall -0 haproxy"
>                interval 2
>                weight 2
>             }
>
>             [...]
>              track_script{
>                     chk_haproxy
>                     }
>             [...]
>
>             However this is not able to change my vrrp state.
>
>
>
>
cheers
thomas

Reply via email to