Heartbeat - Pacemaker - Apache issues

Discussion in 'Server Operation' started by deakon, Feb 27, 2014.

  1. deakon

    deakon New Member

    Hi all,

    I have 2 Debian nodes with heartbeat and pacemaker installed. Everything seems that works fine but I have a little problem and two doubts

    First of all, this my crm configuration:

    node $id="1a806807-0ba5-4f82-9e68-552b80c18031" node01 \
    attributes standby="off"
    node $id="e50dc4cd-fd15-4819-8dda-fd144ab2546d" node02
    primitive apacheha lsb:apache2 \
    op monitor interval="15s" timeout="20s"
    primitive haip1 ocf:heartbeat:IPaddr2 \
    params ip="" cidr_netmask="32" nic="eth0" \
    op monitor interval="30s"
    location cli-prefer-haip1 haip1 \
    rule $id="cli-prefer-rule-haip1" inf: #uname eq node01
    colocation apacheha-haip1 inf: haip1 apacheha
    order ip-apache inf: haip1 apacheha
    property $id="cib-bootstrap-options" \
    dc-version="1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff" \
    cluster-infrastructure="Heartbeat" \
    stonith-enabled="false" \
    expected-quorum-votes="1" \
    no-quorum-policy="ignore" \
    rsc_defaults $id="rsc-options" \

    When I type: "crm node standby node01" everything works as expected, apache service promoted to node02 and the web service keep running. Then, when node01 is active again, the apache resource goes to node01 again. Everything perfect.... BUT

    My problem: I just want to know if I type "/etc/init.d/apache2 stop, the pacemaker resource apache move to node02 but I cant check this cause there are something that restart the service apache2 almost instantly. Cause if node01 does not crash completely, but only apache2 service stop unexpectedly, can pacemaker be configure to migrate the resource to node02?

    1) Why pacemaker is restarting apache2 service automatically and what can I do to stop apache2 service forever until I start it again?

    2) I have a script that I just want to execute only in the active node, how can I know wich node is the master and how can I put that on a script?

    Thanks a lot in advance.
  2. byau

    byau New Member

    Apache is one of your resources and you are monitoring it:

    primitive apacheha lsb:apache2 \
    op monitor interval="15s" timeout="20s"

    That would be your culprit. It is by default and by design to do this.

    As far as the script on the active node, you can make it a dependency on one of the resources on the active node. This is easy to do in the cluster conf itself.

    If you want to do it outside the cluster, one way is to see if the cluster ip address exists on the localhost, if so you know you have the active node.

    Also I noticed you have a two node cluster but no quorum disk - you should probably add that, esp. if this is a production system. If it's for play, then it's a good idea to learn how to do it.

    I have an outline of steps here (I used SLES with pacemaker/openais)


Share This Page