Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7179284d
Commit
7179284d
authored
May 03, 2003
by
lenz@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- applied patch from Tim Bunce (new --addtodest option that adds copied
files into an already existing directory)
parent
1a8b0b38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
9 deletions
+27
-9
scripts/mysqlhotcopy.sh
scripts/mysqlhotcopy.sh
+27
-9
No files found.
scripts/mysqlhotcopy.sh
View file @
7179284d
...
...
@@ -55,7 +55,8 @@ Usage: $0 db_name[./table_regex/] [new_db_name | directory]
-P, --port=# port to use when connecting to local server with TCP/IP
-S, --socket=# socket to use when connecting to local server
--allowold don
\'
t abort if target already exists (rename it _old)
--allowold don
\'
t abort if target dir already exists (rename it _old)
--addtodest don
\'
t rename target dir if it exists, just add files to it
--keepold don
\'
t delete previous (now renamed) target when done
--noindices don
\'
t include full index files in copy
--method=# method for copy (only "cp" currently supported)
...
...
@@ -98,6 +99,7 @@ GetOptions( \%opt,
"socket|S=s"
,
"allowold!"
,
"keepold!"
,
"addtodest!"
,
"noindices!"
,
"method=s"
,
"debug"
,
...
...
@@ -380,14 +382,14 @@ if ($opt{method} =~ /^cp\b/)
push @existing,
$rdb
->
{
target
}
if
(
-d
$rdb
->
{
target
}
)
;
}
if
(
@existing
&&
!
$opt
{
allowold
}
)
if
(
@existing
&&
!
(
$opt
{
allowold
}
||
$opt
{
addtodest
})
)
{
$dbh
->disconnect
()
;
die
"Can't hotcopy to '"
,
join
(
"','"
, @existing
)
,
"' because directory
\n
already exist and the --allowold o
ption was
not given.
\n
"
die
"Can't hotcopy to '"
,
join
(
"','"
, @existing
)
,
"' because directory
\n
already exist and the --allowold o
r --addtodest options were
not given.
\n
"
}
}
retire_directory
(
@existing
)
if
(
@existing
)
;
retire_directory
(
@existing
)
if
@existing
&&
!
$opt
{
addtodest
}
;
foreach my
$rdb
(
@db_desc
)
{
foreach my
$td
(
''
, @
{
$rdb
->
{
raid_dirs
}}
)
{
...
...
@@ -403,8 +405,8 @@ foreach my $rdb ( @db_desc ) {
## ...
}
else
{
mkdir
(
$tgt_dirpath
, 0750
)
or die
"Can't create '
$tgt_dirpath
':
$!
\n
"
;
mkdir
(
$tgt_dirpath
, 0750
)
or die
"Can't create '
$tgt_dirpath
':
$!
\n
"
unless
-d
$tgt_dirpath
;
}
}
}
...
...
@@ -861,6 +863,22 @@ Any existing versions of the backup directory are deleted.
Behaves as
for
the
--allowold
, with the additional feature
of keeping the backup directory after the copy successfully completes.
=
item
--addtodest
Don
't rename target directory if it already exists, just add the
copied files into it.
This is most useful when backing up a database with many large
tables and you don'
t want to have all the tables locked
for
the
whole duration.
In this situation, I<
if
>
you are happy
for
groups
of tables to be
backed up separately
(
and thus possibly not be logically consistant
with one another
)
then
you can run mysqlhotcopy several
times
on
the same database each with different db_name./table_regex/.
All but the first should use the
--addtodest
option so the tables
all end up
in
the same directory.
=
item
--flushlog
Rotate the log files by executing
"FLUSH LOGS"
after all tables are
...
...
@@ -869,13 +887,13 @@ locked, and before they are copied.
=
item
--resetmaster
Reset the bin-log by executing
"RESET MASTER"
after all tables are
locked, and before they are copied. Useful
l
if
you are recovering a
locked, and before they are copied. Useful
if
you are recovering a
slave
in
a replication setup.
=
item
--resetslave
Reset the master.info by executing
"RESET SLAVE"
after all tables are
locked, and before they are copied. Useful
l
if
you are recovering a
locked, and before they are copied. Useful
if
you are recovering a
server
in
a mutual replication setup.
=
item
--regexp
pattern
...
...
@@ -941,7 +959,7 @@ will vary with your ability to understand how scp works. 'man scp'
and
'man ssh'
are your friends.
The destination directory _must exist_ on the target machine using the
scp method.
--keepold
and
--allowold
are me
e
ningless with scp.
scp method.
--keepold
and
--allowold
are me
a
ningless with scp.
Liberal use of the
--debug
option will
help
you figure out what
\'
s
really going on when you
do
an scp.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment