用PCS建立WEB集群,一直不生效怎么解决!-CSDN博客

67 阅读4分钟

心累,耗了我2天时间才解决。

[root@rs1 ~]# pcs resource create Website ocf💓apache
configfile=/etc/httpd/conf/httpd.conf
statusurl=“http://localhost/server-status” \ op monitor interval=1min

[root@rs1 ~]# pcs status Cluster name: cluster1 Stack: corosync
Current DC: rs1 (version 1.1.20-5.el7-3c4c782f70) - partition with
quorum Last updated: Sat May 9 02:29:59 2020 Last change: Sat May 9
02:28:36 2020 by root via cibadmin on rs1

2 nodes configured 2 resources configured

Online: [ rs1 rs2 ]

Full list of resources:

VirtualIP (ocf:💓IPaddr2): Started rs1 Website
(ocf:💓apache): Stopped

Failed Resource Actions:

  • Website_start_0 o n rs1 ‘unknown error’ (1): call=19, status=Timed Out, exitreason=’’,
    last-rc-change=‘Sat May 9 02:29:17 2020’, queued=0ms, exec=40004ms
  • Website_start_0 on rs2 ‘unknown error’ (1): call=14, status=Timed Out, exitreason=’’,
    last-rc-change=‘Sat May 9 02:28:36 2020’, queued=0ms, exec=40006ms

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

在放个日志文件

May  9 02:29:48 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:49 b apache(Website)[12391]: INFO: apache not running
May  9 02:29:49 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:50 b apache(Website)[12391]: INFO: apache not running
May  9 02:29:50 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:51 b apache(Website)[12391]: INFO: apache not running
May  9 02:29:51 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:52 b apache(Website)[12391]: INFO: apache not running
May  9 02:29:52 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:53 b apache(Website)[12391]: INFO: apache not running
May  9 02:29:53 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:54 b apache(Website)[12391]: INFO: apache not running
May  9 02:29:54 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:55 b apache(Website)[12391]: INFO: apache not running
May  9 02:29:55 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:56 b apache(Website)[12391]: INFO: apache not running
May  9 02:29:56 b apache(Website)[12391]: INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
May  9 02:29:57 b lrmd[9228]: warning: Website_start_0 process (PID 12391) timed out
May  9 02:29:57 b lrmd[9228]: warning: Website_start_0:12391 - timed out after 40000ms
May  9 02:29:57 b crmd[9231]:   error: Result of start operation for Website on rs1: Timed Out
May  9 02:29:57 b crmd[9231]: warning: Action 5 (Website_start_0) on rs1 failed (target: 0 vs. rc: 1): Error
May  9 02:29:57 b crmd[9231]:  notice: Transition aborted by operation Website_start_0 'modify' on rs1: Event failed
May  9 02:29:57 b crmd[9231]:  notice: Transition 16 (Complete=2, Pending=0, Fired=0, Skipped=0, Incomplete=1, Source=/var/lib/pacemaker/pengine/pe-input-16.bz2): Complete
May  9 02:29:57 b pengine[9230]: warning: Processing failed start of Website on rs1: unknown error
May  9 02:29:57 b pengine[9230]: warning: Processing failed start of Website on rs1: unknown error
May  9 02:29:57 b pengine[9230]: warning: Processing failed start of Website on rs2: unknown error
May  9 02:29:57 b pengine[9230]: warning: Forcing Website away from rs1 after 1000000 failures (max=1000000)
May  9 02:29:57 b pengine[9230]: warning: Forcing Website away from rs2 after 1000000 failures (max=1000000)
May  9 02:29:57 b pengine[9230]:  notice:  * Stop       Website       (        rs1 )   due to node availability
May  9 02:29:57 b pengine[9230]:  notice: Calculated transition 17, saving inputs in /var/lib/pacemaker/pengine/pe-input-17.bz2

解决方案
重新创建web集群

[root@rs1 html]# pcs resource create Wbsite ocf:heartbeat:apache 
httpd="/usr/sbin/httpd" \
configfile=/etc/httpd/conf/httpd.conf  \
statusurl="http://localhost/server-status" \
op monitor interval=1min
可以看出我在原来的基础上加了一个httpd="/usr/sbin/httpd" \,也就是httpd命令的位置,看结果:
[root@rs1 html]# pcs status
Cluster name: cluster1
Stack: corosync
Current DC: rs1 (version 1.1.20-5.el7-3c4c782f70) - partition with quorum
Last updated: Sat May  9 03:33:01 2020
Last change: Sat May  9 03:21:45 2020 by root via cibadmin on rs1

2 nodes configured
3 resources configured

Online: [ rs1 rs2 ]

Full list of resources:

 VirtualIP	(ocf::heartbeat:IPaddr2):	Started rs1
 WebFS	(ocf::heartbeat:Filesystem):	Started rs1
 Wbsite	(ocf::heartbeat:apache):	Started rs1

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

解决了!