Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
backupninja
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lyz
backupninja
Commits
3cf6de43
Commit
3cf6de43
authored
17 years ago
by
micah
Browse files
Options
Downloads
Patches
Plain Diff
added nodata option to mysql handler, thanks to Daniel Bonniot (Closes: 408829)
parent
02a7436b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
AUTHORS
+1
-1
1 addition, 1 deletion
AUTHORS
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
examples/example.mysql
+7
-0
7 additions, 0 deletions
examples/example.mysql
handlers/mysql.in
+24
-6
24 additions, 6 deletions
handlers/mysql.in
with
36 additions
and
7 deletions
AUTHORS
+
1
−
1
View file @
3cf6de43
...
@@ -15,7 +15,7 @@ rhatto -- rub handler and patches
...
@@ -15,7 +15,7 @@ rhatto -- rub handler and patches
Patches:
Patches:
cmccallum@thecsl.org
cmccallum@thecsl.org
Daniel.Bonniot@inria.fr
Daniel.Bonniot@inria.fr
-- mysql ignores and nodata
Brad Fritz <brad@fritzfam.com> -- trac patch
Brad Fritz <brad@fritzfam.com> -- trac patch
garcondumonde@riseup.net
garcondumonde@riseup.net
Martin Krafft madduck@debian.org -- admingroup patch
Martin Krafft madduck@debian.org -- admingroup patch
...
...
This diff is collapsed.
Click to expand it.
ChangeLog
+
4
−
0
View file @
3cf6de43
...
@@ -24,6 +24,10 @@ version 0.9.5 -- unreleased
...
@@ -24,6 +24,10 @@ version 0.9.5 -- unreleased
mysql:
mysql:
. Fixed case where odd combination of configuration options caused sqldump
. Fixed case where odd combination of configuration options caused sqldump
backups to get overwritten with an empty file (Closes: #402679)
backups to get overwritten with an empty file (Closes: #402679)
. Added 'nodata' option to enable you to specify tables that you want to omit
the data from a backup, but still backup the table structure. This is very
useful in cases where tables contain large amounts of cache data. See the
example.mysql for options, thanks Daniel Bonniot (Closes: #408829)
pgsql:
pgsql:
. Support configuring PGSQLUSER for real, and document it a bit; this
. Support configuring PGSQLUSER for real, and document it a bit; this
broken support actually prevented pgsql handler to work for VServers
broken support actually prevented pgsql handler to work for VServers
...
...
This diff is collapsed.
Click to expand it.
examples/example.mysql
+
7
−
0
View file @
3cf6de43
...
@@ -53,6 +53,13 @@ compress = yes
...
@@ -53,6 +53,13 @@ compress = yes
# which databases to backup. should either be the word 'all' or a
# which databases to backup. should either be the word 'all' or a
# space separated list of database names.
# space separated list of database names.
#
#
# nodata = < table1 table2 table3 > (no default)
# only dump the structure for the database tables listed here, this means
# no data contained in these tables will be dumped. This is very useful
# to backup databases that have tables with cache stored in tables that
# isn't necessary to backup, but you still need the structure to exist
# on a restore
#
# backupdir = < path/to/destination > (default = /var/backups/mysql)
# backupdir = < path/to/destination > (default = /var/backups/mysql)
# where to dump the backups. hotcopy backups will be in a subdirectory
# where to dump the backups. hotcopy backups will be in a subdirectory
# 'hotcopy' and sqldump backups will be in a subdirectory 'sqldump'
# 'hotcopy' and sqldump backups will be in a subdirectory 'sqldump'
...
...
This diff is collapsed.
Click to expand it.
handlers/mysql.in
+
24
−
6
View file @
3cf6de43
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
getconf backupdir /var/backups/mysql
getconf backupdir /var/backups/mysql
getconf databases all
getconf databases all
getconf ignores
getconf ignores
getconf nodata
getconf dbhost localhost
getconf dbhost localhost
getconf hotcopy no
getconf hotcopy no
getconf sqldump no
getconf sqldump no
...
@@ -47,7 +48,7 @@ fi
...
@@ -47,7 +48,7 @@ fi
## This only works for mysqldump at the moment
## This only works for mysqldump at the moment
ignore
=
''
ignore
=
''
for
i
in
$ignores
;
do
for
i
in
$ignores
$nodata
;
do
ignore
=
"
$ignore
--ignore-table=
$i
"
ignore
=
"
$ignore
--ignore-table=
$i
"
done
done
...
@@ -247,6 +248,23 @@ fi
...
@@ -247,6 +248,23 @@ fi
for
db
in
$databases
for
db
in
$databases
do
do
DUMP_BASE
=
"
$MYSQLDUMP
$defaultsfile
--lock-tables --complete-insert --add-drop-table --quick --quote-names"
# Dumping structure and data
DUMP
=
"
$DUMP_BASE
$ignore
$db
"
# If requested, dump only the table structure for this database
if
echo
"
$nodata
"
|
grep
-E
'(^|[[:space:]])'
"
$db
\.
"
>
/dev/null
then
# Get the structure of the tables, without data
DUMP_STRUCT
=
"
$DUMP_BASE
--no-data
$db
"
for
qualified_table
in
$nodata
do
table
=
$(
expr
match
"
$qualified_table
"
"
$db
\.\(
[^
\w
]*
\)
"
)
DUMP_STRUCT
=
"
$DUMP_STRUCT
$table
"
done
DUMP
=
"(
$DUMP
;
$DUMP_STRUCT
)"
fi
if
[
$usevserver
=
yes
]
if
[
$usevserver
=
yes
]
then
then
# Test to make sure mysqld is running, if it is not sqldump will not work
# Test to make sure mysqld is running, if it is not sqldump will not work
...
@@ -255,9 +273,9 @@ fi
...
@@ -255,9 +273,9 @@ fi
fatal
"Either you have an authentication problem, or mysqld doesn't appear to be running!"
fatal
"Either you have an authentication problem, or mysqld doesn't appear to be running!"
fi
fi
if
[
"
$compress
"
==
"yes"
]
;
then
if
[
"
$compress
"
==
"yes"
]
;
then
execstr
=
"
$VSERVER
$vsname
exec
$
MYSQLDUMP
$defaultsfile
--lock-tables --complete-insert --add-drop-table --quick --quote-names
$ignore
$db
|
$GZIP
>
$vroot$dumpdir
/
${
db
}
.sql.gz"
execstr
=
"
$VSERVER
$vsname
exec
$
DUMP
|
$GZIP
>
$vroot$dumpdir
/
${
db
}
.sql.gz"
else
else
execstr
=
"
$VSERVER
$vsname
exec
$
MYSQLDUMP
$defaultsfile
--lock-tables --complete-insert --add-drop-table --quick --quote-names
$ignore
$db
-r
$vroot$dumpdir
/
${
db
}
.sql"
execstr
=
"
$VSERVER
$vsname
exec
$
DUMP
-r
$vroot$dumpdir
/
${
db
}
.sql"
fi
fi
else
else
# Test to make sure mysqld is running, if it is not sqldump will not work
# Test to make sure mysqld is running, if it is not sqldump will not work
...
@@ -266,9 +284,9 @@ fi
...
@@ -266,9 +284,9 @@ fi
fatal
"Either you have an authentication problem, or mysqld doesn't appear to be running!"
fatal
"Either you have an authentication problem, or mysqld doesn't appear to be running!"
fi
fi
if
[
"
$compress
"
==
"yes"
]
;
then
if
[
"
$compress
"
==
"yes"
]
;
then
execstr
=
"
$
MYSQLDUMP
$defaultsfile
--lock-tables --complete-insert --add-drop-table --quick --quote-names
$ignore
$db
|
$GZIP
>
$dumpdir
/
${
db
}
.sql.gz"
execstr
=
"
$
DUMP
|
$GZIP
>
$dumpdir
/
${
db
}
.sql.gz"
else
else
execstr
=
"
$
MYSQLDUMP
$defaultsfile
--lock-tables --complete-insert --add-drop-table --quick --quote-names
$ignore
$db
-r
$dumpdir
/
${
db
}
.sql"
execstr
=
"
$
DUMP
-r
$dumpdir
/
${
db
}
.sql"
fi
fi
fi
fi
debug
"su
$user
-c
\"
$execstr
\"
"
debug
"su
$user
-c
\"
$execstr
\"
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment