我正在使用 Pacemaker 和 Corosync 来设置一个基本的 Apache HA 集群,其中包含 3 个运行 CentOS7 的节点。由于某些原因,我无法在pcs中启动apache资源。
集群IP:192.168.200.40
# pcs resource show ClusterIP
Resource: ClusterIP (class=ocf provider=heartbeat type=IPaddr2)
Attributes: cidr_netmask=24 ip=192.168.200.40
Operations: monitor interval=20s (ClusterIP-monitor-interval-20s)
start interval=0s timeout=20s (ClusterIP-start-interval-0s)
stop interval=0s timeout=20s (ClusterIP-stop-interval-0s)
# pcs resource show WebServer
Resource: WebServer (class=ocf provider=heartbeat type=apache)
Attributes: configfile=/etc/httpd/conf/httpd.conf statusurl=http://localhost/server-status
Operations: monitor interval=1min (WebServer-monitor-interval-1min)
start interval=0s timeout=40s (WebServer-start-interval-0s)
stop interval=0s timeout=60s (WebServer-stop-interval-0s)
# pcs status
Cluster name:
WARNING: corosync and pacemaker node names do not match (IPs used in setup?)
Stack: corosync
Current DC: server3.example.com (version 1.1.18-11.el7_5.2-2b07d5c5a9) - partition with quorum
Last updated: Thu Jun 7 21:59:09 2018
Last change: Thu Jun 7 21:45:23 2018 by root via cibadmin on server1.example.com
3 nodes configured
2 resources configured
Online: [ server1.example.com server2.example.com server3.example.com ]
Full list of resources:
ClusterIP (ocf::heartbeat:IPaddr2): Started server2.example.com
WebServer (ocf::heartbeat:apache): Stopped
Failed Actions:
* WebServer_start_0 on server3.example.com 'unknown error' (1): call=49, status=Timed Out, exitreason='',
last-rc-change='Thu Jun 7 21:46:03 2018', queued=0ms, exec=40002ms
* WebServer_start_0 on server1.example.com 'unknown error' (1): call=53, status=Timed Out, exitreason='',
last-rc-change='Thu Jun 7 21:45:23 2018', queued=0ms, exec=40003ms
* WebServer_start_0 on server2.example.com 'unknown error' (1): call=47, status=Timed Out, exitreason='',
last-rc-change='Thu Jun 7 21:46:43 2018', queued=1ms, exec=40002ms
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
httpd 实例是已启用和跑步在所有三个节点上。集群IP和各个节点IP均能访问网页。 ClusterIP 资源也适用于故障转移。在这种情况下 apache 资源可能会出现什么问题?
非常感谢!
更新:
以下是调试输出的更多信息。看来 Apache 无法绑定到该端口,但 apache 日志中没有错误,并且systemctl status httpd
在所有节点上都显示为绿色。我可以通过集群IP和每个节点IP打开网页。 ClusterIP 资源故障转移也运行良好。知道为什么 Apache 资源不能与起搏器一起使用吗?
# pcs resource debug-start WebServer --full
Operation start for WebServer (ocf:heartbeat:apache) failed: 'Timed Out' (2)
> stderr: ERROR: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs
> stderr: INFO: apache not running
> stderr: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
> stderr: INFO: apache not running
> stderr: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
> stderr: INFO: apache not running
> stderr: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
> stderr: INFO: apache not running
答案1
我认为这是因为httpd
PID 文件位置。我遇到了同样的问题,我通过添加“ PidFile /var/run/httpd.pid
”httpd.conf
并禁用webserver
资源然后启动httpd
和webserver
资源工作来解决它。
我知道在这些长间隔之后添加答案是无关紧要的,但它可能会对某人有所帮助。