Apache Failed to Start in Pacemaker
In CentOS8
doing this...
pcs resource create httpd_monitor ocf:heartbeat:apache \
configfile="/etc/httpd/conf/httpd.conf" \
statusurl="http://127.0.0.1/server-status" --group apache
The file /etc/httpd/conf/httpd.conf
is checked for the PidFile
parameter. This is not defined, but defaults to /var/run/httpd/httpd.pid
[root@hanode1 ~]# pcs resource
* Resource Group: apache:
* httpd_fs (ocf::heartbeat:Filesystem): Started hanode1.lab.local
* httpd_vip (ocf::heartbeat:IPaddr2): Started hanode1.lab.local
* apache_service (service:httpd): Started hanode1.lab.local
* httpd_monitor (ocf::heartbeat:apache): Stopped
You get this error message
Feb 02 17:39:21 INFO: apache not running
Feb 02 17:39:21 INFO: waiting for apache /etc/httpd/conf/httpd.conf to come up
So if you define this in /etc/httpd/conf/httpd.conf
# this is the default but is required by pcs to be defined
PidFile /var/run/httpd/httpd.pid
This will run fine, as below:
[root@hanode1 ~]# pcs resource debug-start httpd_monitor
Operation start for httpd_monitor (ocf:heartbeat:apache) returned: 'ok' (0)
Feb 02 17:39:57 INFO: apache already running (pid 88022)
Then you can clean up with pcs resource cleanup httpd_monitor
# pcs resource
* Resource Group: apache:
* httpd_fs (ocf::heartbeat:Filesystem): Started hanode1.lab.local
* httpd_vip (ocf::heartbeat:IPaddr2): Started hanode1.lab.local
* apache_service (service:httpd): Started hanode1.lab.local
* httpd_monitor (ocf::heartbeat:apache): Started hanode1.lab.local
kudos to @cleverpig