Hi all,
I was running into a problem with my LVS configuration exactly like the
poster at this link:
http://archive.linuxvirtualserver.org/html/lvs-users/2007-10/msg00067.html
Everything seemed to be working, except I couldn't access the service itself
(mysql in this case) from the virtual IP address
from a non-LVS director box.
In looking at the ldirectord debug output, it became appearant that that was
the culprit. Initially I was getting that same error
of "Use of uninitialized value in split at /usr/sbin/ldirectord line 2642."
That was actually being caused by the code at line 2731:
2727 # I guess that in a pathalogical case the query may fail
2728 # at a particular row. But I'm not going to worry about that
for
2729 # now.
2730 $row = $sth->fetchrow_arrayref;
2731 unless ($row && $sth->err) {
2732 check_sql_log_errstr("Error fetching row:",
$dbh->errstr);
2733 goto err_finish;
2734 }
I am not a perl developer at all, but it appears that ldirectord is assuming
that fetchrow_arrayref will never leave sth->err undefined,
but in this case DBD::mysql leaves it undefined if the query is successful.
I put in the following line:
while ( $row = $sth->fetchrow_arrayref() ) { &ld_log("@{$row}\n"); }
To see that yes indeed the query was successful and the proper data was
returned, but ldirectord still was invoking its error logic.
It seems that the easy (e.g. not necessarily correct for other DB's) fix to
this would be to change:
unless ($row && $sth->err) {
To:
unless ($row) {
Or something like:
unless ($row && !defined($sth->err)) { #or whatever the proper syntax is
here
After changing this line to that first choice, ldirectord started and ran
fine.
Here's the patch against what should be the newest ldirectord in CVS:
--- ldirectord.orig 2007-12-28 06:31:13.000000000 +0000
+++ ldirectord 2007-12-28 06:31:51.000000000 +0000
@@ -2728,7 +2728,7 @@ sub check_sql
# at a particular row. But I'm not going to worry about that for
# now.
$row = $sth->fetchrow_arrayref;
- unless ($row && $sth->err) {
+ unless ($row) {
check_sql_log_errstr("Error fetching row:", $dbh->errstr);
goto err_finish;
}
Hopefully one of the ldirectord devs sees this and can commit this change or
a similar one, as this is a show-stopper for mysql LVS setups . at least
from the guides that I went by:
http://www.howtoforge.com/loadbalanced_mysql_cluster_debian
http://www.ultramonkey.org/3/topologies/sl-ha-lb-eg.html
Thanks,
Robby
|