[Pacemaker] ocf:heartbeat:mysql RA update

Dan Frincu dfrincu at streamwide.ro
Thu Oct 21 05:21:07 EDT 2010


Hi Florian,

Sorry from the beginning, this will be a long email. The modifications 
I've made aren't really encountered in a regular setup, that's why I 
said, I posting my work, _maybe_ it benefits somebody.

The mysql RA checks if mysql is up by looking at the pid, if [ ! -e 
$OCF_RESKEY_pid]; then => not running. I've had to go through a case where:
- mysql is installed (at the end of the installation process it starts)
- the hostname of the server is changed without shutting down mysql 
first (thus the pid is still there, but named after the old hostname)
- trying to start mysql after hostname changed without checking for 
running instances => pid manager quit without updating pid file.

For this case I've added the double_check() function which verifies if 
there is a network socket. If ! -e $OCF_RESKEY_pid && no network socket, 
mysql is down => $OCF_NOT_RUNNING.
If ! -e $OCF_RESKEY_pid && network socket exists => pid_check().

pid_check() finds if running pid != $OCF_RESKEY_pid and returns 
$OCF_ERR_INSTALLED + email alert.

If pid is ok and mysql is running, begin a detailed database check. 
First query contents of a table, if $? -eq 0 => $OCF_SUCCESS, else run 
db_check().

db_check() queries the defined database (cluster, in this example), if 
it works => $OCF_SUCCESS, else check "show databases". If $? -eq 0, 
"cluster" database not installed, return $OCF_ERR_INSTALLED + email, 
else $OCF_ERR_GENERIC + email => no rights for the current user to do a 
"show database" or no database available.

If db_check() returns 0, it means that the table query is not done 
properly, but the database exists => $OCF_ERR_INSTALLED + email.

Again, I stress this isn't a normal setup, meaning on a standard setup 
you wouldn't require anything else than the mysql_monitor() query (ok, 
maybe the double_check and pid_check functions would be required, for 
any _paranoid_ setups). In my setup, these were required, especially the 
email sending part and having different checks for the mysql database, 
table, etc.

Attached are only the changes, no diff's this time, basically only the 
mysql_status() function changed, the rest have been added, so I think 
they can be read better this way.

Regards,

Dan

Florian Haas wrote:
> Hi Dan,
>
> Thanks for the contribution -- but unfortunately that patch is pretty
> much impossible to review as it is. Can you please break this down into
> logical chunks, use "diff -u" (or "hg diff") format, and most
> importantly explain _why_ you made the changes you made?
>
> Cheers,
> Florian
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker
>   

-- 
Dan FRINCU
Systems Engineer
CCNA, RHCE
Streamwide Romania

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20101021/257a1082/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mysql.ra.func.txt
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20101021/257a1082/attachment-0003.txt>


More information about the Pacemaker mailing list