0

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.

  • Server1(lbserver.my.com) IP:192.168.10.88 (Active)
  • 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

user2821056
  • 11
  • 1
  • 3

1 Answers1

0

I would suggest using Pacemaker and Corosync. This is the defacto Linux cluster stack in many peoples opinions. The setup is a little more involved, but the payoff is much greater.

It may be a little too much to explain in a single stack post, so I would recommend Googling around some using Pacemaker HA Apache cluster as some keywords.

Alternatively, you can jump on Freenode (IRC) and drop into #clusterlabs and ask for some help there.

Matt Kereczman
  • 1,899
  • 9
  • 12