Jenny Chen wrote:
Hi, Keith,

In my case, it is just single MySQL server(no replication).
Thanks for your info, I'll check with mk-parallel-dump tools, since
the speed of backup is important considering the database is locked for the
duration of the backup.

Well, if you're saying that you're only using innodb then you don't need to lock the server. I'm using the attached script for backups. We configure our slaves to use the given $slave_socket (to prevent normal programs from writing to the db by accident), that's the reason for the optional --access-slave flag.

Christian.
#!/usr/bin/perl -w

# Fre Sep 30 12:46:38 MEST 2005
(my $email='christian%jaeger,mine,nu')=~ tr/%,/@./;

use strict;

my $slave_socket= "--socket=/var/run/mysqld/mysqld_safe.sock";

$0=~ /(.*?)([^\/]+)\z/s or die "?"; 
my ($mydir, $myname)=($1,$2); 
sub usage {
    print STDERR map{"$_\n"} @_ if @_;
    print "$myname [${myname}_options] -- additional_mysqldump_options

  call mysqldump with options to safely backup innodb databases.
  warning: does not handle myisam tables safely!

  options: only one:
   --access-slave   access socket '$slave_socket'

  (Christian T+J <$email>)
";
exit @_ ? 1 : 0;
}

my @args;
my $DEBUG=0;
my ($opt_access_slave);

for (my $i=0; $i<=$#ARGV; $i++) {
    local $_=$ARGV[$i];
    if (/^--?h(elp)?$/) {
        usage
    } elsif ($_ eq '--') {
        push @args, @ARGV[$i+1..$#ARGV];
        last;
    } elsif (/^--?d(ebug)?$/) {
        $DEBUG=1;
    } elsif (/^--access-slave$/) {
        $opt_access_slave=1;
#     } elsif (/^--?X(?:XXX(?:=(.*))?)?$/) {
#         if (defined $1) {
#             $XXX=$1
#         } else {
#             $XXX=$ARGV[++$i] or usage "missing argument for '$_' option";
#         }
    } elsif (/^-./) {
        usage("Unknown option '$_'\n");
    } else {
        push @args, $_
    }
}
usage unless @args;

if ($opt_access_slave) {
    unshift @args, $slave_socket;
}

sub xexec {
    if ($DEBUG) {
        print join (" ¦ ",@_),"\n"
    } else {
        exec @_ or exit 127;
    }
}

xexec
  qw(mysqldump -O single-transaction=TRUE --skip-lock-tables --add-drop-table 
--all  --extended-insert --quick --skip-add-locks ),@args;


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

Reply via email to