2011-08-16 45 views
1

我们有两台带有Pacemaker(crm)设置的服务器,可启用主/备用群集。目前有两种服务由Pacemaker控制/监控,如果发生故障,将导致故障切换到备用服务器,我们自己的定制服务(以下称为customservice1)和mysql。如何使用Pacemaker重新启动httpd

customservice1和mysql在备用服务器上停止并且在主服务器上运行(显然)。当故障转移发生时,看起来心脏起搏器会停止这两种情况(或者如果只有一个人出于任何原因失败,我不太清楚这一点,确保他们停止),更改主要和备用的IP地址(以便DNS中的别名将始终转到主服务器上),然后在之前的备用服务器上启动customservice1和mysql。

我想添加一个步骤,由pacemaker控制,只需在发生故障转移时重新启动httpd。目前httpd一直在主服务器和备用服务器上运行。目前,httpd中的故障不会导致故障转移,我对增加监控并不感兴趣,我只是想让起搏器在使备用服务器成为主服务器时运行相当于'service httpd restart'的服务。

添加只能重新启动服务的新基元的正确语法是什么?

目前起搏器配置如下:

node $id="XX" some.machine.name \ 
     attributes standby="off" 
node $id="YY" another.machine.name 
primitive customservice1 lsb:customservice1 \ 
     op monitor interval="30s" timeout="30s" \ 
     op start interval="0" timeout="120" \ 
     op stop interval="0" timeout="120" \ 
     meta target-role="Started" 
primitive mysql-server ocf:heartbeat:mysql \ 
     params binary="/usr/bin/mysqld_safe" config="/etc/my.cnf" datadir="/some/data/dir" user="mysql" pid="/var/lib/mysql/mysql.pid" socket="/var/lib/mysql/mysql.sock" \ 
     op monitor interval="30s" timeout="30s" \ 
     op start interval="0" timeout="120" \ 
     op stop interval="0" timeout="120" 
primitive node1-stonith stonith:external/riloe \ 
     params hostlist="some.machine.name" ilo_user="Administrator" ilo_hostname="some-ilo.machine.name" ilo_password="<ilopassword>" ilo_can_reset="1" ilo_protocol="2.0" ilo_powerdown_method="button" \ 
     op monitor interval="120s" timeout="40s" \ 
     meta target-role="Started" 
primitive node2-stonith stonith:external/riloe \ 
     params hostlist="another.machine.name" ilo_user="Administrator" ilo_hostname="another-ilo.machine.name" ilo_password="<ilopassword>" ilo_can_reset="1" ilo_protocol="2.0" ilo_powerdown_method="button" \ 
     op monitor interval="120s" timeout="40s" \ 
     meta target-role="Started" 
primitive node_one_ip ocf:heartbeat:IPaddr2 \ 
     params ip="1.1.1.1" cidr_netmask="255.255.255.0" nic="eth0" \ 
     op monitor interval="40s" timeout="20s" 
primitive node_two_ip ocf:heartbeat:IPaddr2 \ 
     params ip="1.1.1.2" cidr_netmask="255.255.255.0" nic="eth0" \ 
     op monitor interval="40s" timeout="20s" \ 
     meta target-role="Started" 
group only-group node_one_ip mysql-server customservice1 
property $id="cib-bootstrap-options" \ 
     dc-version="1.0.9-89bd754939df5150de7cd76835f98fe90851b677" \ 
     cluster-infrastructure="Heartbeat" \ 
     no-quorum-policy="ignore" \ 
     last-lrm-refresh="1287686604" \ 
     default-resource-stickiness="1" 

回答

0

为了起搏器做到这一点,你需要把HTTP服务器起搏器的控制之下,然后创建组和HTTP之间的排序约束守护进程。 从内存中,您需要确保约束条件下得分> 0。

否则,您需要修改现有资源的脚本以根据需要重新启动httpd。

+0

“将http服务器置于Pacemaker的控制下”是否意味着不仅仅是为它添加原语?假设不,我可以让我的新原型成为现有团队的成员吗?关于httpd与其他团队成员之间并没有什么需要尊重的顺序,但我可能只是先做出来。 – twilbrand

0

您需要添加的httpd原始起搏器:

primitive apache2 ocf:heartbeat:apache \ 
    params configfile="/etc/apache2/apache2.conf" \ 
    op monitor interval="30s" timeout="20s" \ 
    op start interval="0" timeout="40s" \ 
    op stop interval="0" timeout="60s" 

或者,如果你想使用脚本LSB:

primitive apache2 lsb:apache2 \ 
    op monitor interval="30s" timeout="20s" \ 
    op start interval="0" timeout="40s" \ 
    op stop interval="0" timeout="60s" 

而在你的 '唯一团' 加 '的Apache2'组(关于订单)

group only-group node_one_ip mysql-server customservice1 apache2