<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Checking MySQL Replication</title>
	<atom:link href="http://www.brandonchecketts.com/archives/checking-mysql-replication/feed" rel="self" type="application/rss+xml" />
	<link>http://www.brandonchecketts.com/archives/checking-mysql-replication</link>
	<description>Web Programming, Linux System Administation, and other geeky stuff</description>
	<pubDate>Tue, 06 Jan 2009 05:17:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Brandon Checketts &#187; Blog Archive &#187; Fixing a Corrupt MySQL Relay Log</title>
		<link>http://www.brandonchecketts.com/archives/checking-mysql-replication/comment-page-1#comment-1052</link>
		<dc:creator>Brandon Checketts &#187; Blog Archive &#187; Fixing a Corrupt MySQL Relay Log</dc:creator>
		<pubDate>Tue, 30 Sep 2008 18:10:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonchecketts.com/?p=190#comment-1052</guid>
		<description>[...] had to fix this several times in the past couple days. If that keeps up, I may add this fix to my Replication checking-script until I&#8217;m able to upgrade to a version of MySQL that contains this [...]</description>
		<content:encoded><![CDATA[<p>[...] had to fix this several times in the past couple days. If that keeps up, I may add this fix to my Replication checking-script until I&#8217;m able to upgrade to a version of MySQL that contains this [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon</title>
		<link>http://www.brandonchecketts.com/archives/checking-mysql-replication/comment-page-1#comment-1026</link>
		<dc:creator>Brandon</dc:creator>
		<pubDate>Thu, 14 Aug 2008 20:32:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonchecketts.com/?p=190#comment-1026</guid>
		<description>Here is the same basic script written in Perl (because I found a machine that had a completely broken PHP installation that I didn't want to troubleshoot at the time)

&lt;pre&gt;
#!/usr/bin/perl

$user = 'someuser';
$pass = 'somepassword';
$host = 'localhost';

$threshold = 600;

use DBI;
use Data::Dumper;

$dbh = DBI-&gt;connect("DBI:mysql:mysql", $user, $pass
                   ) &#124;&#124; die "Could not connect to database: $DBI::errstr";


$sth = $dbh-&gt;prepare('SHOW SLAVE STATUS');
$sth-&gt;execute();
$result = $sth-&gt;fetchrow_hashref();

if (!$result-&gt;{'Seconds_Behind_Master'}) {
        print "MySQL replication seems to be broken.    Here is the output of SHOW SLAVE STATUS\n";
        print Dumper($result);
}

if ($result-&gt;{'Seconds_Behind_Master'} &#62;= $threshold) {
        $minutes = $result-&gt;{'Seconds_Behind_Master'} / 60;
        printf("ERROR: MySQL Slave is %i minutes behind the master server\n", $minutes);
}


exit;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Here is the same basic script written in Perl (because I found a machine that had a completely broken PHP installation that I didn&#8217;t want to troubleshoot at the time)</p>
<pre>
#!/usr/bin/perl

$user = 'someuser';
$pass = 'somepassword';
$host = 'localhost';

$threshold = 600;

use DBI;
use Data::Dumper;

$dbh = DBI->connect("DBI:mysql:mysql", $user, $pass
                   ) || die "Could not connect to database: $DBI::errstr";

$sth = $dbh->prepare('SHOW SLAVE STATUS');
$sth->execute();
$result = $sth->fetchrow_hashref();

if (!$result->{'Seconds_Behind_Master'}) {
        print "MySQL replication seems to be broken.    Here is the output of SHOW SLAVE STATUS\n";
        print Dumper($result);
}

if ($result->{'Seconds_Behind_Master'} &gt;= $threshold) {
        $minutes = $result->{'Seconds_Behind_Master'} / 60;
        printf("ERROR: MySQL Slave is %i minutes behind the master server\n", $minutes);
}

exit;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Checketts &#187; Blog Archive &#187; Compression for MySQL Replication</title>
		<link>http://www.brandonchecketts.com/archives/checking-mysql-replication/comment-page-1#comment-985</link>
		<dc:creator>Brandon Checketts &#187; Blog Archive &#187; Compression for MySQL Replication</dc:creator>
		<pubDate>Sat, 26 Jul 2008 00:02:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonchecketts.com/?p=190#comment-985</guid>
		<description>[...] noticed today that the slave server was falling behind the master and had trouble keeping up. I noticed that there was a sizable amount of bandwidth between the two [...]</description>
		<content:encoded><![CDATA[<p>[...] noticed today that the slave server was falling behind the master and had trouble keeping up. I noticed that there was a sizable amount of bandwidth between the two [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
