4.3. 在 overcloud 上测试隔离

要测试隔离是否正常工作,请通过关闭 Controller 节点上的所有端口并重新启动服务器来触发隔离。

重要

此流程有意丢弃与 Controller 节点的所有连接,这会导致节点重启。

先决条件

流程

  1. stack 用户身份登录 Controller 节点,并提供凭据文件:

    $ source stackrc
    $ openstack server list | grep controller
    $ ssh heat-admin@<controller-x_ip>
  2. 进入 root 用户并关闭到 Controller 节点的所有连接:

    $ sudo -i
    iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT &&
    iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT &&
    iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 5016 -j ACCEPT &&
    iptables -A INPUT -p udp -m state --state NEW -m udp --dport 5016 -j ACCEPT &&
    iptables -A INPUT ! -i lo -j REJECT --reject-with icmp-host-prohibited &&
    iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT &&
    iptables -A OUTPUT -p tcp --sport 5016 -j ACCEPT &&
    iptables -A OUTPUT -p udp --sport 5016 -j ACCEPT &&
    iptables -A OUTPUT ! -o lo -j REJECT --reject-with icmp-host-prohibited
  3. 在不同的 Controller 节点上,在 Pacemaker 日志文件中找到隔离事件:

    $ ssh heat-admin@<controller-x_ip>
    $ less /var/log/cluster/corosync.log
    (less): /fenc*

    如果 STONITH 服务对 Controller 执行隔离操作,则日志文件会显示隔离事件。

  4. 等待几分钟,然后通过运行 pcs status 命令验证重启的 Controller 节点是否在集群中再次运行。如果您在输出中看到重启的 Controller 节点,隔离功能可以正常工作。