How to configure apache with active passive setup

和自甴很熟 提交于 2019-12-11 08:51:45

问题


I have two servers both having Apache httpd with identical configurations Server1 and Server2. I want to create active and passive setup for these servers.

  1. Server1(lbserver.my.com) IP:192.168.10.88 (Active)
  2. Server2(lbserver.my.com) IP:192.168.10.89 (Passive)

Server1 should respond to http requests. In case Server1 goes down then Server2 should become Active server and respond to http requests. Can anyone suggest how to achieve this. I tried this with keepalived configured on both the servers with Virtual IP:192.168.20.90 for both of them However I am not able to check if httpd is running on Server1 in keepalived.conf. The passive server i.e Server2 only responds to http requests only if Server1 goes off the network. My configuration in keepalived.conf is as follows.

    vrrp_script chk_haproxy{
    script "killall -0 httpd"
    interval 2
    weight 2
    }

    vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 101
    advert_int 1
    authentication {
         auth_type PASS
         auth_pass 1111
    }
virtual_ipaddress {
    192.168.10.90
}
track_script{
    chk_haproxy
}
}

I also tried with script "pidof httpd"

I want passive server to start responding once httpd on server1 goes down. Can anyone suggest me on this. Also correct me if any other approach needs to be followed for this setup. Any help will be appreciated

来源:https://stackoverflow.com/questions/42791699/how-to-configure-apache-with-active-passive-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!