电脑正在运行,但状态显示资源已停止

电脑正在运行,但状态显示资源已停止

我第一次设置 pcs。我有两台 CentOS 7 VM,我在它们上安装了 pcs 和 Pacemaker。我定义了一个虚拟 IP 和 Apache HTTP 集群。

两个虚拟机的 IP 分别为 192.168.56.121 和 192.168.56.122。VIP 配置为 192.168.56.199。我可以 ping 通 VIP,并且可以在 VIP 上打开测试 index.html。

根据此处的另一篇文章,我已停止并禁用 httpd.service,因为 pcs 管理其操作。firewalld 和 SELinux 均已禁用。

我有两个问题:首先,两个节点上的 index.html 只有一行文本,写着“节点 1”和“节点 2”。多次刷新页面后,我发现只有节点 1 的文件可用,除非我停止该节点,在这种情况下节点 2 的文件可用。这表明节点处于主动-备用状态。有没有办法使其成为一个负载均衡器,两个节点都为交替请求提供服务?

其次,pcs状态显示资源处于停止状态,尽管ping和http可以正常工作。

展示内容如下pcs status

Cluster name: mycluster
Stack: corosync
Current DC: db21 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum
Last updated: Tue Jan  5 15:47:00 2021
Last change: Tue Jan  5 11:28:04 2021 by root via cibadmin on db21

2 nodes configured
2 resource instances configured

Online: [ db21 db22 ]

Full list of resources:

 Resource Group: webgroup
     apache_res (ocf::heartbeat:apache):        Stopped
     vip_res    (ocf::heartbeat:IPaddr2):       Stopped

Failed Resource Actions:
* apache_res_start_0 on db21 'unknown error' (1): call=10, status=Timed Out, exitreason='',
    last-rc-change='Tue Jan  5 11:32:43 2021', queued=1ms, exec=40019ms
* apache_res_start_0 on db22 'unknown error' (1): call=10, status=Timed Out, exitreason='',
    last-rc-change='Tue Jan  5 11:33:24 2021', queued=0ms, exec=40021ms

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

输出pcs config show

Cluster Name: mycluster
Corosync Nodes:
 db21 db22
Pacemaker Nodes:
 db21 db22

Resources:
 Group: webgroup
  Resource: apache_res (class=ocf provider=heartbeat type=apache)
   Attributes: configfile=/etc/httpd/conf/httpd.conf statusurl=http://127.0.0.1/server-status
   Operations: monitor interval=10s timeout=20s (apache_res-monitor-interval-10s)
               start interval=0s timeout=40s (apache_res-start-interval-0s)
               stop interval=0s timeout=60s (apache_res-stop-interval-0s)
  Resource: vip_res (class=ocf provider=heartbeat type=IPaddr2)
   Attributes: cidr_netmask=24 ip=192.168.56.199
   Operations: monitor interval=10s timeout=20s (vip_res-monitor-interval-10s)
               start interval=0s timeout=20s (vip_res-start-interval-0s)
               stop interval=0s timeout=20s (vip_res-stop-interval-0s)

Stonith Devices:
Fencing Levels:

Location Constraints:
Ordering Constraints:
Colocation Constraints:
Ticket Constraints:

Alerts:
 No alerts defined

Resources Defaults:
 No defaults set
Operations Defaults:
 No defaults set

Cluster Properties:
 cluster-infrastructure: corosync
 cluster-name: mycluster
 dc-version: 1.1.23-1.el7_9.1-9acf116022
 have-watchdog: false
 stonith-enabled: false

Quorum:
  Options:

哪个日志文件或命令可以显示状态显示为停止的原因?

相关内容