Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何使用起搏器重新启动httpd_Linux_Cluster Computing_Apache_High Availability_Failover - Fatal编程技术网

Linux 如何使用起搏器重新启动httpd

Linux 如何使用起搏器重新启动httpd,linux,cluster-computing,apache,high-availability,failover,Linux,Cluster Computing,Apache,High Availability,Failover,我们有两台带有Pacemaker(crm)设置的服务器,可以启用主/备用群集。目前有两个由Pacemaker控制/监控的服务,如果其中一个出现故障,将导致故障转移到备用系统,即我们自己的定制服务(以下称为customservice1)和mysql customservice1和mysql在备用服务器上停止,在主服务器上运行(显然)。当发生故障转移时,pacemaker似乎会同时停止(或者确保只有一个因任何原因失败时停止,我不太清楚这一点),更改主设备和备用设备的ip地址(以便DNS中的别名始终转

我们有两台带有Pacemaker(crm)设置的服务器,可以启用主/备用群集。目前有两个由Pacemaker控制/监控的服务,如果其中一个出现故障,将导致故障转移到备用系统,即我们自己的定制服务(以下称为customservice1)和mysql

customservice1和mysql在备用服务器上停止,在主服务器上运行(显然)。当发生故障转移时,pacemaker似乎会同时停止(或者确保只有一个因任何原因失败时停止,我不太清楚这一点),更改主设备和备用设备的ip地址(以便DNS中的别名始终转到主设备),然后在以前的备用服务器上启动customservice1和mysql

我想在此基础上添加一个步骤,由pacemaker控制,只要发生故障转移就可以重新启动httpd。httpd当前始终在主设备和备用设备上运行。httpd中的故障目前不会导致故障转移,我对添加该监控并不感兴趣,我只是希望pacemaker在使备用设备成为主设备时运行与“service httpd restart”(服务httpd重启)相同的功能

添加只会重新启动服务的新原语的正确语法是什么?

当前起搏器配置如下:

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"
节点$id=“XX”some.machine.name\
属性standby=“off”
节点$id=“YY”另一个.machine.name
原语customservice1 lsb:customservice1\
操作监视器间隔=“30s”超时=“30s”\
操作开始间隔=“0”超时=“120”\
操作停止间隔=“0”超时=“120”\
元目标角色=“已启动”
原始mysql服务器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”\
操作监视器间隔=“30s”超时=“30s”\
操作开始间隔=“0”超时=“120”\
操作停止间隔=“0”超时=“120”
原始节点1 stonith stonith:外部/riloe\
params hostlist=“some.machine.name”ilo_user=“Administrator”ilo_hostname=“some ilo.machine.name”ilo_password=“”ilo_can_reset=“1”ilo_protocol=“2.0”ilo_powerdown\u method=“button”\
操作监视器间隔=“120s”超时=“40s”\
元目标角色=“已启动”
原始节点2 stonith stonith:外部/riloe\
params hostlist=“other.machine.name”ilo\u user=“Administrator”ilo\u hostname=“other ilo.machine.name”ilo\u password=“”ilo\u can\u reset=“1”ilo\u protocol=“2.0”ilo\u powerdown\u method=“button”\
操作监视器间隔=“120s”超时=“40s”\
元目标角色=“已启动”
基本节点\u one\u ip ocf:心跳信号:IPaddr2\
参数ip=“1.1.1.1”cidr_netmask=“255.255.255.0”nic=“eth0”\
操作监视器间隔=“40s”超时=“20s”
基本节点\u two\u ip ocf:心跳信号:IPaddr2\
params ip=“1.1.1.2”cidr_netmask=“255.255.255.0”nic=“eth0”\
操作监视器间隔=“40s”超时=“20s”\
元目标角色=“已启动”
仅组组节点\u一个\u ip mysql服务器customservice1
属性$id=“cib引导选项”\
dc version=“1.0.9-89bd754939df5150de7cd76835f98fe90851b677”\
集群基础设施=“心跳”\
无法定人数策略=“忽略”\
上次lrm刷新=“1287686604”\
默认资源粘性=“1”

为了让Pacemaker做到这一点,您需要将http服务器置于Pacemaker的控制之下,然后在组和http守护进程之间创建一个排序约束。 从内存中,您需要确保约束的分数>0


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

您需要在Pacemaker上添加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”(关注订单)

“将http服务器置于Pacemaker的控制之下”是否意味着为其添加一个原语?假设不是,我可以让我的新原语成为现有组的成员吗?关于httpd与该集团其他成员的对比,没有什么真正需要遵守的命令,但我可能会先做。
group only-group node_one_ip mysql-server customservice1 apache2