If a slave dies, is there any way to determine that state from an external point of view (ie: via Perl/DBD) so we can write a script of some kind to either connect to the slave and issue a "START SLAVE" or send the last xx lines of the .err log file to our tech staff?

I tried writing a Perl script to run a query of "SHOW SLAVE STATUS" and parsing the 30-or-so fields that would otherwise return, but it's complaining:


DBD::mysql::st execute failed: Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation at ./checkslave.pl line 19.

Snippet of code:

my $dbh_2 = DBI->connect("dbi:mysql:ouofa:slave2.domain.org","systemcheck","mypasswd",
{ RaiseError => 1, AutoCommit => 0, PrintError => 0 } ) or die ("SLAVE2 MySQL database offline: $!") ;


my $cur_info = $dbh_2->prepare("SHOW SLAVE STATUS") ;
$cur_info->execute() ;
my @row = $cur_info->fetchrow_array() ;

... line 19 would be the ->execute() call.

I did this:

GRANT SUPER,REPLICATION CLIENT to 'syscheck'@'mywebserver.domain.org' IDENTIFIED BY 'mypasswd' ;

... on the slaves, but that didn't help me any.

How can I check a slave's status without having to manually log in to a mysql client??

-id


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to