Re: replication general question

2005-06-23 Thread Gleb Paharenko
Hello.



I haven't heard about periodical MySQL jobs, but Unix boxes usually have

some midnight cron jobs (updating of locate database for example).







[EMAIL PROTECTED] wrote:

> 

> I have two mysql boxes setup.  Fast machines, I think they are dual 3ghz with 
> boat loads of ram.  They are not real busy servers but they have some pretty 
> good sized tables, one of them with a few million rows.

> 

> My question is, I have Nagios setup to monitor the seconds behind master on 
> the backup server.  Usually the boxes are pretty current, within ten or 
> twenty seconds.  Other times though they seem to get way behind, like I just 
> bumped the nagios warning email level up to 600 seconds.  It doesn't seem to 
> have anything to do really with usage because it usually happens in the 
> middle of the night.  Does Mysql do re-indexing or something?  What could I 
> do to figure out why the replicatant box is getting so far behind?

> 

> --ja

> 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
   <___/   www.mysql.com




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



Re: replication general question

2005-06-23 Thread jabbott

I don't think network latency would be an issue.  This is within a protected 
network dmz so it has it's own switch.

Here is the nagios script stuff.  Might be more than what you need but let me 
know if you are able to use some of it.

I have two on the server.  first, I have:

[EMAIL PROTECTED] jabbott]# more secondsBehind.sh
#!/bin/sh
mysql -pMYSECRET -e "show slave status\G" | grep Seconds

Then I have this that I run in the rc.local.  This sets up a port that listens 
for a connection on port 5151.  I have hole open in my firewall into my dmz for 
port 5151

[EMAIL PROTECTED] jabbott]# more socket.pl
#!/usr/bin/perl
use IO::Socket;
$server_port = 5151;

$server = IO::Socket::INET->new(LocalPort => $server_port,
Type  => SOCK_STREAM,
Reuse => 1,
Listen=> 10)
or die "Could not be a tcp server on port $server_port : [EMAIL PROTECTED]";
while ($client = $server->accept ()) {
my $sysArg = `/home/jabbott/secondsBehind.sh`;
# uncomment the next line for debugging
print " $client is the new connection\n\n";
print $client "$sysArg\n";
print "connect \n";
close ($client);
}
close ($server);

Then, on the Nagios side I have this:

$ cat /usr/lib/nagios/plugins/mysql-replication-lag.pl
#!/usr/bin/perl -w

use strict;
use lib "nagios/plugins" ;
use utils qw($TIMEOUT %ERRORS);

use IO::Socket;

$ENV{'PATH'}='';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
my ($ip_address,$port,$warn,$critical) = @ARGV;

# Just in case of problems, let's not hang Nagios
$SIG{'ALRM'} = sub {
   print "No Answer from Client\n";
   exit $ERRORS{"UNKNOWN"};
};
alarm($TIMEOUT);

my $sock = new IO::Socket::INET(
   PeerAddr => $ip_address,
   PeerPort => $port,
   Proto=> 'tcp',
   );

unless ($sock) {
   print "Socket could not be created. Reason: $!\n";
  exit $ERRORS{'UNKNOWN'};
}
my $result = <$sock> || "Could not read socket\n";
close($sock);
alarm(0);

print $result;
unless ($result =~ /^\s*Seconds_Behind_Master:\s*/i) {
   exit $ERRORS{'UNKNOWN'};
}

$result =~ s/\D//g;

exit $ERRORS{'CRITICAL'} if ($result>$critical);
exit $ERRORS{'WARNING'}  if ($result>$warn);
exit $ERRORS{'OK'}

1;
__END__

On Thu, 23 Jun 2005, James Green wrote:

> 
> Checked for network latency? I have replication running on similar
> hardware hooked up to the same switch, and have never seen it rise above
> 0 seconds behind.
> 
> Not that I check often, I have no need to...
> 
> Is your nagios script open for public use - I was about to have to write
> something for this task myself.
> 
> Thanks,
> 
> James
> 
> 
> On 23/6/2005, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> 
> >
> >I have two mysql boxes setup.  Fast machines, I think they are dual 3ghz 
> >with boat loads of ram.  They are not real busy servers but they have some 
> >pretty good sized tables, one of them with a few million rows.
> >
> >My question is, I have Nagios setup to monitor the seconds behind master on 
> >the backup server.  Usually the boxes are pretty current, within ten or 
> >twenty seconds.  Other times though they seem to get way behind, like I just 
> >bumped the nagios warning email level up to 600 seconds.  It doesn't seem to 
> >have anything to do really with usage because it usually happens in the 
> >middle of the night.  Does Mysql do re-indexing or something?  What could I 
> >do to figure out why the replicatant box is getting so far behind?
> >
> >--ja
> >
> >--
> >
> >
> >--
> >MySQL General Mailing List
> >For list archives: http://lists.mysql.com/mysql
> >To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
> >
> >
> >
> 

-- 


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



Re: replication general question

2005-06-23 Thread Atle Veka
What type of drives to you have on your system? That is often more
important than CPU speed. My guess is that there are nightly maintenance
crons slowing down disk access.

I have never monitored replication via the seconds-behind-master function
as we do not use 4.1, so I can't speak for how accurate it is..


Atle
-
Flying Crocodile Inc, Unix Systems Administrator

On Thu, 23 Jun 2005 [EMAIL PROTECTED] wrote:

>
> I have two mysql boxes setup.  Fast machines, I think they are dual 3ghz
> with boat loads of ram.  They are not real busy servers but they have
> some pretty good sized tables, one of them with a few million rows.
>
> My question is, I have Nagios setup to monitor the seconds behind master
> on the backup server.  Usually the boxes are pretty current, within ten
> or twenty seconds.  Other times though they seem to get way behind, like
> I just bumped the nagios warning email level up to 600 seconds.  It
> doesn't seem to have anything to do really with usage because it usually
> happens in the middle of the night.  Does Mysql do re-indexing or
> something?  What could I do to figure out why the replicatant box is
> getting so far behind?
>
> --ja
>
> --
>
>
>

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



replication general question

2005-06-23 Thread jabbott

I have two mysql boxes setup.  Fast machines, I think they are dual 3ghz with 
boat loads of ram.  They are not real busy servers but they have some pretty 
good sized tables, one of them with a few million rows.

My question is, I have Nagios setup to monitor the seconds behind master on the 
backup server.  Usually the boxes are pretty current, within ten or twenty 
seconds.  Other times though they seem to get way behind, like I just bumped 
the nagios warning email level up to 600 seconds.  It doesn't seem to have 
anything to do really with usage because it usually happens in the middle of 
the night.  Does Mysql do re-indexing or something?  What could I do to figure 
out why the replicatant box is getting so far behind?

--ja

-- 


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