packages: bacula-backup-mysql/bacula-backup-mysql, bacula-backup-mysql/bacu...
glen
glen at pld-linux.org
Fri Mar 16 18:29:21 CET 2012
Author: glen Date: Fri Mar 16 17:29:21 2012 GMT
Module: packages Tag: HEAD
---- Log message:
- allow include_database to contain table regexp like mysqlhotcopy(1)
---- Files affected:
packages/bacula-backup-mysql:
bacula-backup-mysql (1.14 -> 1.15) , bacula-backup-mysql.conf (1.3 -> 1.4)
---- Diffs:
================================================================
Index: packages/bacula-backup-mysql/bacula-backup-mysql
diff -u packages/bacula-backup-mysql/bacula-backup-mysql:1.14 packages/bacula-backup-mysql/bacula-backup-mysql:1.15
--- packages/bacula-backup-mysql/bacula-backup-mysql:1.14 Fri Mar 16 18:25:47 2012
+++ packages/bacula-backup-mysql/bacula-backup-mysql Fri Mar 16 18:29:16 2012
@@ -6,7 +6,7 @@
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
@@ -26,7 +26,6 @@
use File::Temp qw(tempdir);
use File::Path qw(rmtree);
-
# path to Apache HTTPd-style config
my $config = '/etc/bacula/backup-mysql.conf';
my $c = new BBM::Config($config);
@@ -41,13 +40,13 @@
chdir("/");
$) = "$gid $gid";
- $( = $gid;
- $> = $< = $uid;
+ $( = $gid;
+ $> = $< = $uid;
}
# setup tmpdir
my $backup_dir = $c->get('options', 'outdir') or die "'outdir' not defined in config\n";
-my $tmpdir = $c->get('options', 'tmpdir') or die "'tmpdir' not defined in config\n";
+my $tmpdir = $c->get('options', 'tmpdir') or die "'tmpdir' not defined in config\n";
if (!-d $backup_dir && !mkdir($backup_dir) && !-d $backup_dir) {
die "backup dir '$backup_dir' not present and can't be created\n";
@@ -71,9 +70,13 @@
# Usage: mysqlhotcopy $CLUSTER $DATABASE $USERNAME $PASSWORD $SOCKET
#
sub mysqlhotcopy {
- my ($cluster, $database, $user, $password, $socket) = @_;
+ my ($cluster, $db, $user, $password, $socket) = @_;
+
+ # strip $database to contain only db name, as the rest of the code assumes $database is just database name
+ # i.e: include_database teensForum5./~(phorum_forums|phorum_users)/
+ my ($database) = $db =~ /^([^\.]+)/;
- print ">>>> mysqlhotcopy $database\n";
+ print ">>>> mysqlhotcopy $db\n";
my $dstdir = tempdir("bbm.XXXXXX", DIR => $tmpdir);
@@ -82,7 +85,7 @@
push(@shell, '-u', $user) if $user;
push(@shell, '-p', $password) if $password;
push(@shell, '-S', $socket) if $socket;
- push(@shell, $database, $dstdir);
+ push(@shell, $db, $dstdir);
system(@shell) == 0 or die "mysqlhotcopy failed: $?\n";
# put it to "production dir"
@@ -235,15 +238,21 @@
In C<E<lt>clusterE<gt>> sections, you should list databases to be backed up.
You can use C<include_database> option to implicitly list which databases to be
backed up. If you omit C<include_database> option, all databases are backed up
-which can be seen with C<show tables> query. To exclude databases from that
+which can be seen with C<show tables> query. To exclude databases from that
list you can use C<exclude_database> options.
+Additionally C<include_database> supports table regexp, which is passed
+directly to mysqlhotcopy(1). This allows you to include or exclude tables from
+each database backup.
+
=head1 EXAMPLE CONFIGURATION
# clusters to backup
# there is nothing special about name "mysql", name just picked as convience
<clusters>
cluster mysql
+ cluster eventum
+ cluster forums
</clusters>
# client connection parameters, can be overriden per cluster
@@ -262,6 +271,15 @@
<cluster mysql>
socket /var/lib/mysql/mysql.sock
exclude_database mysql
+ </cluster>
+
+ # forums cluster: exclude phorum_forums and phorum_users tables
+ <cluster forums>
+ user mysql
+ socket /var/lib/mysql/mysql.sock
+
+ # include_database can also support table regexp for mysqlhotcopy:
+ include_database teensForum5./~(phorum_forums|phorum_users)/
</cluster>
=head1 AUTHOR
================================================================
Index: packages/bacula-backup-mysql/bacula-backup-mysql.conf
diff -u packages/bacula-backup-mysql/bacula-backup-mysql.conf:1.3 packages/bacula-backup-mysql/bacula-backup-mysql.conf:1.4
--- packages/bacula-backup-mysql/bacula-backup-mysql.conf:1.3 Wed Dec 15 14:31:03 2010
+++ packages/bacula-backup-mysql/bacula-backup-mysql.conf Fri Mar 16 18:29:16 2012
@@ -33,8 +33,13 @@
password
socket /var/lib/mysql/mysql.sock
+ # exclude database has only effect if no include_database is selected
exclude_database won2backup
exclude_database test
+
include_database won2_ui
include_database delfi_watson2
+
+ # include_database can also support table regexp for mysqlhotcopy:
+ include_database teensForum5./~(phorum_forums|phorum_users)/
</cluster>
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/bacula-backup-mysql/bacula-backup-mysql?r1=1.14&r2=1.15&f=u
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/bacula-backup-mysql/bacula-backup-mysql.conf?r1=1.3&r2=1.4&f=u
More information about the pld-cvs-commit
mailing list