我第一次設定電腦。我有兩台 CentOS 7 虛擬機,在上面安裝了電腦和 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 管理其操作。與 SELinux 一樣,firewalld 已停用。
我有兩個問題:首先,兩個節點上的 index.html 是一行文本,表示「節點 1」和「節點 2」。多次刷新頁面,我發現只有節點 1 檔案被提供,除非我停止該節點,在這種情況下,節點 2 的檔案被提供。這表示節點處於主備狀態。有什麼辦法讓它成為一個負載平衡器,兩個節點都服務交替請求?
其次,pcs status 顯示資源處於停止狀態,儘管 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:
哪個日誌檔案或指令可以顯示為什麼狀態顯示為已停止?