Comment posted How to check MASTER / SLAVE MySQL nodes status – Check MySQL Replication Status by .
Recent comments by
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Hey long time now see, thanks for dropping back again! 🙂
Previoust Post:
Next Post:
Tags: Auto, Cipher, cmd, condition, configure, Connect, Draft, event, exec, host, info, key, Master, master node, master slave, mysql server, name, Path, quot, Replicate, replication, Retry, server node, show, slave status, someone, Space, SQL, time, User
This entry was posted
on Friday, April 26th, 2024 at 6:41 am and is filed under MySQL, System Administration, Web and CMS.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Hello,
If your are interrested, here is the script I've done a few years ago to monitor the replication into my monitoring system
#!/usr/bin/perl -w
use strict;
use DBI;
# Script to test MySQL replication by TRD 08/01/2008
if (scalar(@ARGV)==3) {
#Variables
my $dbServer="DBI:mysql:database=syslog;host=$ARGV[0]";
my $dbUser=$ARGV[1];
my $dbPwd=$ARGV[2];
#Connect to DB
my $db=DBI->connect($dbServer,$dbUser,$dbPwd) || exit 2;
my $rs=$db->prepare('show slave status');
View CommentView Comment$rs->execute();
my $dr=$rs->fetchrow_hashref();
my $Slave_IO_Running=$dr->{'Slave_IO_Running'};
my $Slave_SQL_Running=$dr->{'Slave_SQL_Running'};
$rs->finish();
$db->disconnect();
if (($Slave_IO_Running eq 'Yes') && ($Slave_SQL_Running eq 'Yes')) {
exit 0;
}
else {
exit 2;
}
}
else {
print "Missing parameter\n";
exit 1;
}
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Hi Thibs,
Long time no hear you. This is nice script.
Only I need to change the name of the monitored database, cause right now I got error;
# perl monitor-replication.pl localhost root password
DBI connect(‘database=syslog;host=localhost’,’root’,…) failed: Unknown database ‘syslog’ at monitor-replication.pl line 15
I’ve made minor modifications to your script and added some text to clear up the script is written by you as well as a link to your site http://qmailrocks.thibs.com for further reference.
The script is here: http://www.pc-freak.net/bshscr/not-mine/monitor-replication.pl
As it was recently Easter the passed sunday and we have the habit to great each other with the paschal Greeting. I would like to great you with our paschal Greeting Jesus is Risen!
Best
View CommentView CommentGeorgi
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Thanks for all ! Great andholy Easter to you !
View CommentView CommentMozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Thanks for all ! Great and holy Easter to you !
View CommentView CommentFor the script, I can adapt it o allow database name beeing passed as parameter.
Note that according to my experience, it's useless to check replication for all replicated database .. one is enough to check the whole replication status