Apache OCF resource agent tidak mau start ketika modul SSL diaktifkan

Posted on Updated on


Lagi-lagi masih seputar pacemaker dan apache2, setelah kemarin ketemu masalah, sekarang ketemu lagi masalah Apache OCF resource agent tidak mau start saat server direstart, akhirnya ketemu… ternyata dikarenakan folder /var/run/apache2 nya hilang/dihapus ketika server direstart, sedangkan /var/run/apache2 digunakan oleh apache jika SSL module diaktifkan.

Error log di apache :

[error] (2) No such file or directory: Cannot create SSLMutex with file `/var/run/apache2/ssl_mutex'

Ternyata ini adalah bug resource-agents

Solusinya adalah di-patch atau tambahkan di script OCF apachenya agar membuat folder /var/run/apache2 sebelum apachenya start.

# vi /usr/lib/ocf/resource.d/heartbeat/apache
...
start_apache() {
  if
    silent_status
  then
    ocf_log info "$CMD already running (pid $ApachePID)"
    return $OCF_SUCCESS
  fi

  [ -d /var/run/apache2 ] || mkdir /var/run/apache2 # <--- tambahkan baris berikut

  ocf_run $HTTPD $HTTPDOPTS $OPTIONS -f $CONFIGFILE
  tries=0
  while :  # wait until the user set timeout
  do
    monitor_apache
        ec=$?
        if [ $ec -eq $OCF_NOT_RUNNING ]
        then
                tries=`expr $tries + 1`
                ocf_log info "waiting for apache $CONFIGFILE to come up"
                sleep 1
        else
                break
        fi
  done
        if [ $ec -ne 0 ] && silent_status; then
                stop_apache
        fi
        return $ec
}
...

Semoga bermanfaat…

Leave a comment