Merge lp:~stewart/percona-xtrabackup/drop-remote-host into lp:percona-xtrabackup/2.0

Proposed by Stewart Smith
Status: Rejected
Rejected by: Stewart Smith
Proposed branch: lp:~stewart/percona-xtrabackup/drop-remote-host
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 498 lines (+31/-230)
4 files modified
doc/source/innobackupex/how_innobackupex_works.rst (+0/-2)
doc/source/innobackupex/innobackupex_option_reference.rst (+2/-15)
doc/source/innobackupex/remote_backups_ibk.rst (+1/-14)
innobackupex (+28/-199)
To merge this branch: bzr merge lp:~stewart/percona-xtrabackup/drop-remote-host
Reviewer Review Type Date Requested Status
Stewart Smith (community) Disapprove
Review via email: mp+98156@code.launchpad.net

Description of the change

drop remote host support in XB2.0

To post a comment you must log in.
Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

Stewart,

I would think we need to drop it totally on XB2.1
and in 2.0 only to mark it as DEPRECATED.
We should leave enough time for users to accommodate this change.

Revision history for this message
Stewart Smith (stewart) wrote :
Revision history for this message
Stewart Smith (stewart) wrote :

> Stewart,
>
> I would think we need to drop it totally on XB2.1
> and in 2.0 only to mark it as DEPRECATED.
> We should leave enough time for users to accommodate this change.

we are marking deprecated in 1.6...

Revision history for this message
Stewart Smith (stewart) wrote :

We will hold off this merge until XB 2.1

review: Disapprove

Unmerged revisions

403. By Stewart Smith

remove the (now unused) --sshopt and --scpopt options to innobackupex. This goes along with the --remote-host removal, all in favor of streaming backups

402. By Stewart Smith

remove the --remote-host option from innobackupex - it is removed in favor of streaming backups

401. By Stewart Smith

null merge from 1.6

400. By Stewart Smith

merge fix for bug#938594: assert on --prepare --apply-log-only

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'doc/source/innobackupex/how_innobackupex_works.rst'
--- doc/source/innobackupex/how_innobackupex_works.rst 2012-02-14 08:31:46 +0000
+++ doc/source/innobackupex/how_innobackupex_works.rst 2012-03-19 07:15:24 +0000
@@ -53,8 +53,6 @@
53:file:`mysql-stdout`53:file:`mysql-stdout`
54 containing the ``STDOUT`` of the server.54 containing the ``STDOUT`` of the server.
5555
56If the :option:`--remote-host` was set, |innobackupex| will test the connection to the host via :command:`ssh` and create the backup directories. Then the same process will be applied but the log will be written to a temporary file and will be copied via :command:`scp` with the options set by :option:`--scpopt` (``-Cp -c arcfour`` by default).
57
58After each copy the files will be deleted. The same rationale is for the :option:`--stream` mode.56After each copy the files will be deleted. The same rationale is for the :option:`--stream` mode.
5957
60Finally, the binary log position will be printed to ``STDERR`` and |innobackupex| will exit returning 0 if all went OK.58Finally, the binary log position will be printed to ``STDERR`` and |innobackupex| will exit returning 0 if all went OK.
6159
=== modified file 'doc/source/innobackupex/innobackupex_option_reference.rst'
--- doc/source/innobackupex/innobackupex_option_reference.rst 2012-02-14 08:31:46 +0000
+++ doc/source/innobackupex/innobackupex_option_reference.rst 2012-03-19 07:15:24 +0000
@@ -115,17 +115,13 @@
115115
116 This option accepts a string argument that specifies the directory in which to save an extra copy of the :file:`xtrabackup_checkpoints` file. It is passed directly to |xtrabackup|'s :option:`--extra-lsndir` option. See the :program:`xtrabackup` documentation for details.116 This option accepts a string argument that specifies the directory in which to save an extra copy of the :file:`xtrabackup_checkpoints` file. It is passed directly to |xtrabackup|'s :option:`--extra-lsndir` option. See the :program:`xtrabackup` documentation for details.
117117
118.. option:: --remote-host
119
120 This option accepts a string argument that specifies the remote host on which the backup files will be created, by using an ssh connection.
121
122.. option:: --stream118.. option:: --stream
123119
124 This option accepts a string argument that specifies the format in which to do the streamed backup. The backup will be done to ``STDOUT`` in the specified format. Currently, the only supported format is :command:`tar`. Uses :doc:`tar4ibd <../tar4ibd/tar4ibd_binary>`, which is available in *XtraBackup* distributions. If you specify a path after this option, it will be interpreted as the value of :option:`tmpdir`. If both :option:`--stream` and :option:`--incremental` are passed to innobackupex, the incremental parameters are ignored and a full backup is created.120 This option accepts a string argument that specifies the format in which to do the streamed backup. The backup will be done to ``STDOUT`` in the specified format. Currently, the only supported format is :command:`tar`. Uses :doc:`tar4ibd <../tar4ibd/tar4ibd_binary>`, which is available in *XtraBackup* distributions. If you specify a path after this option, it will be interpreted as the value of :option:`tmpdir`. If both :option:`--stream` and :option:`--incremental` are passed to innobackupex, the incremental parameters are ignored and a full backup is created.
125121
126.. option:: --tmpdir122.. option:: --tmpdir
127123
128 This option accepts a string argument that specifies the location where a temporary file will be stored. It should be used when :option:`--remote-host` or :option:`--stream` is specified. For these options, the transaction log will first be stored to a temporary file, before streaming or copying to a remote host. This option specifies the location where that temporary file will be stored. If the option is not specifed, the default is to use the value of ``tmpdir`` read from the server configuration.124 This option accepts a string argument that specifies the location where a temporary file will be stored. It should be used when :option:`--stream` is specified. For these options, the transaction log will first be stored to a temporary file, before streaming or copying to a remote host. This option specifies the location where that temporary file will be stored. If the option is not specifed, the default is to use the value of ``tmpdir`` read from the server configuration.
129125
130.. option:: --tar4ibd126.. option:: --tar4ibd
131127
@@ -135,14 +131,6 @@
135131
136 This option forces the use of :command:`tar` when creating a streamed backup, rather than :program:`tar4ibd`, which is the default.132 This option forces the use of :command:`tar` when creating a streamed backup, rather than :program:`tar4ibd`, which is the default.
137133
138.. option:: --scpopt = '-Cp -c arcfour'
139
140 This option accepts a string argument that specifies the command line options to pass to :command:`scp` when the option :option:`--remost-host` is specified. If the option is not specified, the default options are ``-Cp -c arcfour``.
141
142.. option:: --sshopt
143
144 This option accepts a string argument that specifies the command line options to pass to :command:`ssh` when the option :option:`--remost-host` is specified.
145
146.. option:: --parallel134.. option:: --parallel
147135
148 This option accepts an integer argument that specifies the number of threads the :program:`xtrabackup` child process should use to back up files concurrently. Note that this option works on file level, that is, if you have several .ibd files, they will be copied in parallel. If you have just single big .ibd file, it will have no effect. It is passed directly to xtrabackup's :option:`xtrabackup --parallel` option. See the :program:`xtrabackup` documentation for details.136 This option accepts an integer argument that specifies the number of threads the :program:`xtrabackup` child process should use to back up files concurrently. Note that this option works on file level, that is, if you have several .ibd files, they will be copied in parallel. If you have just single big .ibd file, it will have no effect. It is passed directly to xtrabackup's :option:`xtrabackup --parallel` option. See the :program:`xtrabackup` documentation for details.
@@ -162,5 +150,4 @@
162 uses :program:`rsync` to copy all non-InnoDB files instead of150 uses :program:`rsync` to copy all non-InnoDB files instead of
163 spawning a separate :program:`cp` for each file, which can be much151 spawning a separate :program:`cp` for each file, which can be much
164 faster for servers with a large number of databases or tables. This152 faster for servers with a large number of databases or tables. This
165 option cannot be used together with :option:`--remote-host` or153 option cannot be used together with :option:`--stream`.
166 :option:`--stream`.
167154
=== modified file 'doc/source/innobackupex/remote_backups_ibk.rst'
--- doc/source/innobackupex/remote_backups_ibk.rst 2012-02-02 20:24:24 +0000
+++ doc/source/innobackupex/remote_backups_ibk.rst 2012-03-19 07:15:24 +0000
@@ -2,17 +2,4 @@
2 Sending Backups to Remote Hosts with |innobackupex|2 Sending Backups to Remote Hosts with |innobackupex|
3=====================================================3=====================================================
44
5Besides of using the :option:`--stream` for sending the backup to another host via piping (see :doc:`streaming_backups_innobackupex`), |innobackupex| can do it directly with the :option:`--remote-host` ::5As of Percona XtraBackup 2.0, you should use the :option:`--stream` optino for sending a backup to another host via piping (see :doc:`streaming_backups_innobackupex`).
6
7 $ innobackupex --remote-host=REMOTEUSER@REMOTEHOST /path/IN/REMOTE/HOST/to/backup/
8
9|innobackupex| will test the connection to ``REMOTEHOST`` via :command:`ssh` and create the backup directories needed as the ``REMOTEUSER`` you specified. The options for :command:`ssh` can be specified with :option:`--sshopt`
10
11.. warning:: The path you provide for storing the backup will be created at ``REMOTEHOST``, not at the local host.
12
13Then all the log files will be written to a temporary file (you can choose where to store this file with the :option:`--tmpdir` option) and will be copied via :command:`scp`. The options for :command:`scp` can be specified with :option:`--options-scp` (``-Cp -c arcfour`` by default), for example::
14
15 $ innobackupex --remote-host=REMOTEUSER@REMOTEHOST /path/IN/REMOTE/HOST/to/backup/ \
16 --tmpdir=/tmp --options-scp="-Cp -c arcfour"
17
18
196
=== modified file 'innobackupex'
--- innobackupex 2012-02-14 04:00:10 +0000
+++ innobackupex 2012-03-19 07:15:24 +0000
@@ -96,7 +96,6 @@
96my $option_incremental_dir = '';96my $option_incremental_dir = '';
97my $option_incremental_lsn = '';97my $option_incremental_lsn = '';
98my $option_extra_lsndir = '';98my $option_extra_lsndir = '';
99my $option_remote_host = '';
100my $option_rsync = '';99my $option_rsync = '';
101my $option_stream = '';100my $option_stream = '';
102my $stream_cmd = '';101my $stream_cmd = '';
@@ -104,8 +103,6 @@
104103
105my $option_tar4ibd = '';104my $option_tar4ibd = '';
106my $option_force_tar = '';105my $option_force_tar = '';
107my $option_scp_opt = '-Cp -c arcfour';
108my $option_ssh_opt = '';
109106
110my $option_parallel = '';107my $option_parallel = '';
111108
@@ -283,11 +280,7 @@
283} else {280} else {
284 # make a backup of InnoDB and MyISAM tables, indexes and .frm files.281 # make a backup of InnoDB and MyISAM tables, indexes and .frm files.
285 $ibbackup_exit_code = backup();282 $ibbackup_exit_code = backup();
286 if ($option_remote_host) {283 if ($option_stream) {
287 open(XTRABACKUP_BINARY,
288 "| ssh $option_ssh_opt $option_remote_host 'cat > $backup_dir/$xtrabackup_binary_file'")
289 || die "Failed to open file '$option_remote_host:$backup_dir/$xtrabackup_binary_file': $!";
290 } elsif ($option_stream) {
291 open XTRABACKUP_BINARY, "> $option_tmpdir/$xtrabackup_binary_file"284 open XTRABACKUP_BINARY, "> $option_tmpdir/$xtrabackup_binary_file"
292 || die "Cannot open file $option_tmpdir/$xtrabackup_binary_file: $!\n";285 || die "Cannot open file $option_tmpdir/$xtrabackup_binary_file: $!\n";
293 } else {286 } else {
@@ -389,9 +382,7 @@
389 start_ibbackup();382 start_ibbackup();
390383
391 # wait for ibbackup to suspend itself384 # wait for ibbackup to suspend itself
392 if (!$option_remote_host) {385 wait_for_ibbackup_suspend();
393 wait_for_ibbackup_suspend();
394 }
395386
396 # connect to database387 # connect to database
397 mysql_open();388 mysql_open();
@@ -434,11 +425,7 @@
434425
435 # copy ib_lru_dump426 # copy ib_lru_dump
436 if (-e "$orig_datadir/ib_lru_dump") {427 if (-e "$orig_datadir/ib_lru_dump") {
437 if ($option_remote_host) {428 if ($option_stream) {
438 print STDERR "$prefix Backing up file 'ib_lru_dump'\n";
439 system("scp $option_scp_opt '$orig_datadir/ib_lru_dump' '$option_remote_host:$backup_dir/ib_lru_dump'")
440 and Die "Failed to scp file 'ib_lru_dump': $!";
441 } elsif ($option_stream) {
442 print STDERR "$prefix Backing up as tar stream 'ib_lru_dump'\n";429 print STDERR "$prefix Backing up as tar stream 'ib_lru_dump'\n";
443 system("cd $orig_datadir; tar chf - ib_lru_dump")430 system("cd $orig_datadir; tar chf - ib_lru_dump")
444 and Die "Failed to stream 'ib_lru_dump': $!";431 and Die "Failed to stream 'ib_lru_dump': $!";
@@ -450,16 +437,6 @@
450 }437 }
451 }438 }
452439
453 if ($option_remote_host) {
454 system("scp $option_scp_opt '$tmp_logfile' '$option_remote_host:$backup_dir/xtrabackup_logfile'")
455 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_logfile': $!";
456 unlink $tmp_logfile || Die "Failed to delete '$tmp_logfile': $!";
457
458 system("scp $option_scp_opt '$option_tmpdir/xtrabackup_checkpoints' '$option_remote_host:$backup_dir/xtrabackup_checkpoints'")
459 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_checkpoints': $!";
460 unlink "$option_tmpdir/xtrabackup_checkpoints" || Die "Failed to delete '$option_tmpdir/xtrabackup_checkpoints': $!";
461 }
462
463 print STDERR "\n$prefix Backup created in directory '$backup_dir'\n";440 print STDERR "\n$prefix Backup created in directory '$backup_dir'\n";
464 if ($mysql_binlog_position) {441 if ($mysql_binlog_position) {
465 print STDERR "$prefix MySQL binlog position: $mysql_binlog_position\n";442 print STDERR "$prefix MySQL binlog position: $mysql_binlog_position\n";
@@ -864,14 +841,11 @@
864841
865 $options = $options . "--backup --suspend-at-end";842 $options = $options . "--backup --suspend-at-end";
866843
867 if (!$option_remote_host && !$option_stream) {844 if (!$option_stream) {
868 $options = $options . " --target-dir=$backup_dir";845 $options = $options . " --target-dir=$backup_dir";
869 } else {846 } else {
870 #(datadir) for 'xtrabackup_suspended' and 'xtrabackup_checkpoints'847 #(datadir) for 'xtrabackup_suspended' and 'xtrabackup_checkpoints'
871 $options = $options . " --target-dir=" . $option_tmpdir;848 $options = $options . " --target-dir=" . $option_tmpdir;
872 if ($option_remote_host) {
873 $options = $options . " --log-stream";
874 }
875 }849 }
876850
877 # prepare command line for running ibbackup851 # prepare command line for running ibbackup
@@ -921,97 +895,7 @@
921 if ($pid) {895 if ($pid) {
922 # parent process896 # parent process
923 $ibbackup_pid = $pid;897 $ibbackup_pid = $pid;
924
925 if($option_remote_host) {
926 #direct copy to remote
927 my $orig_datadir = get_option(\%config, 'mysqld', 'datadir');
928 my $orig_ibdata_dir =
929 get_option(\%config, 'mysqld', 'innodb_data_home_dir');
930 my $orig_innodb_data_file_path =
931 get_option(\%config, 'mysqld', 'innodb_data_file_path');
932 my $innodb_flush_method =
933 get_option(\%config, 'mysqld', 'innodb_flush_method');
934 my $innodb_use_odirect;
935 $innodb_use_odirect = 1 if $innodb_flush_method =~ m/^(ALL_)?O_DIRECT$/i;
936
937 my $subdir;
938 my @list;
939
940 if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/ib_logfile0")
941 == 0) {
942 print STDERR "$prefix Remove $option_remote_host:$backup_dir/ib_logfile*\n";
943 system("ssh $option_ssh_opt $option_remote_host rm $backup_dir/ib_logfile\*")
944 and Die "Failed to rm file '$backup_dir/ib_logfile*': $!";
945 }
946
947 wait_for_ibbackup_suspend();
948
949 #InnoDB data files from original InnoDB data directory
950 print STDERR "\n$prefix Starting to backup InnoDB tables and indexes\n";
951 print STDERR "$prefix to '$backup_dir'\n";
952 print STDERR "$prefix from original InnoDB data directory '$orig_ibdata_dir'\n";
953 foreach my $a (split(/;/, $orig_innodb_data_file_path)) {
954 my $path = (split(/:/,$a))[0];
955 $path=~s/([\$\\\" ])/\\$1/g;
956 print STDERR "$prefix Backing up file '$orig_ibdata_dir/$path'\n";
957 system("scp $option_scp_opt '$orig_ibdata_dir/$path' '$option_remote_host:$backup_dir/$path'")
958 and Die "Failed to scp file '$path': $!";
959 }
960
961 #copy *.ibd files
962 opendir(DIR, $orig_datadir)
963 || Die "Can't open directory '$orig_datadir': $!\n";
964 while (defined($subdir = readdir(DIR))) {
965 my $print_each_file = 0;
966 my $file_c;
967 my $file;
968 if ($subdir eq '.' || $subdir eq '..') { next; }
969 next unless -d "$orig_datadir/$subdir";
970 next unless check_if_required($subdir);
971
972 @list = glob("$orig_datadir/$subdir/" . '*.ibd');
973
974 $file_c = @list;
975 if ($file_c <= $backup_file_print_limit) {
976 $print_each_file = 1;
977 } else {
978 print STDERR "$prefix Backing up files " .
979 "'$orig_datadir/$subdir/*.ibd' ($file_c files)\n";
980 }
981 foreach $file (@list) {
982 next unless check_if_required($subdir, $file);
983 if($option_include) {
984 my $table_name;
985
986 $table_name = substr($file, rindex($file, '/'));
987 $table_name = substr($table_name, 1, rindex($table_name, '.') - 1);
988 $table_name = $subdir . "." . $table_name;
989
990 if (!($table_name =~ /$option_include/)) {
991 print STDERR "'$file' is skipped.\n";
992 next;
993 }
994 }
995
996 if ($print_each_file) {
997 print STDERR "$prefix Backing up file '$file'\n";
998 }
999 if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/$subdir")
1000 != 0) {
1001 system("ssh $option_ssh_opt $option_remote_host mkdir $backup_dir/$subdir");
1002 }
1003 system("scp $option_scp_opt '$file' '$option_remote_host:$backup_dir/$subdir/'")
1004 and Die "Failed to scp file '$file': $!";
1005 }
1006 }
1007 closedir(DIR);
1008 }
1009 } else {898 } else {
1010 if($option_remote_host) {
1011 open(STDOUT, "> $tmp_logfile")
1012 || Die "Failed to open file '$tmp_logfile': $!"
1013 }
1014
1015 # child process899 # child process
1016 exec($cmdline) || Die "Failed to exec ibbackup: $!";900 exec($cmdline) || Die "Failed to exec ibbackup: $!";
1017 }901 }
@@ -1215,13 +1099,10 @@
1215 if (!defined $info_lines[1]) {1099 if (!defined $info_lines[1]) {
1216 $info_lines[1] = "";1100 $info_lines[1] = "";
1217 }1101 }
1218 if (!$option_remote_host) {1102
1219 open(FILE, ">$binlog_info") || 1103 open(FILE, ">$binlog_info") ||
1220 Die "Failed to open file '$binlog_info': $!";1104 Die "Failed to open file '$binlog_info': $!";
1221 } else {1105
1222 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $binlog_info'") ||
1223 Die "Failed to open file '$option_remote_host:$binlog_info': $!";
1224 }
1225 print FILE "$info_lines[1]\n";1106 print FILE "$info_lines[1]\n";
1226 close(FILE);1107 close(FILE);
12271108
@@ -1312,13 +1193,9 @@
1312 }1193 }
13131194
1314 # print slave status to a file1195 # print slave status to a file
1315 if (!$option_remote_host) {1196 open(FILE, ">$slave_info") ||
1316 open(FILE, ">$slave_info") || 1197 Die "Failed to open file '$slave_info': $!";
1317 Die "Failed to open file '$slave_info': $!";1198
1318 } else {
1319 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $slave_info'") ||
1320 Die "Failed to open file '$option_remote_host:$slave_info': $!";
1321 }
1322 print FILE "CHANGE MASTER TO MASTER_LOG_FILE='$filename', MASTER_LOG_POS=$position\n";1199 print FILE "CHANGE MASTER TO MASTER_LOG_FILE='$filename', MASTER_LOG_POS=$position\n";
1323 close(FILE);1200 close(FILE);
13241201
@@ -1590,13 +1467,10 @@
15901467
1591 if (!$option_apply_log && !$option_copy_back) {1468 if (!$option_apply_log && !$option_copy_back) {
1592 # we are making a backup, create a new backup directory1469 # we are making a backup, create a new backup directory
1593 if (!$option_remote_host) {1470 $backup_dir = File::Spec->rel2abs(make_backup_dir());
1594 $backup_dir = File::Spec->rel2abs(make_backup_dir());1471
1595 } else {
1596 $backup_dir = make_backup_dir();
1597 }
1598 print STDERR "$prefix Created backup directory $backup_dir\n";1472 print STDERR "$prefix Created backup directory $backup_dir\n";
1599 if (!$option_remote_host && !$option_stream) {1473 if (!$option_stream) {
1600 $backup_config_file = $backup_dir . '/backup-my.cnf';1474 $backup_config_file = $backup_dir . '/backup-my.cnf';
1601 $suspend_file = $backup_dir . '/xtrabackup_suspended';1475 $suspend_file = $backup_dir . '/xtrabackup_suspended';
1602 $binlog_info = $backup_dir . '/xtrabackup_binlog_info';1476 $binlog_info = $backup_dir . '/xtrabackup_binlog_info';
@@ -1645,14 +1519,8 @@
1645 }1519 }
1646 $innodb_data_file_path = join(";", @array);1520 $innodb_data_file_path = join(";", @array);
16471521
1648 if (!$option_remote_host) {1522 $root = $backup_dir;
1649 $root = $backup_dir;1523 open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";
1650 open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";
1651 } else {
1652 $root = `ssh $option_ssh_opt $option_remote_host 'cd $backup_dir; pwd'`;
1653 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $filename'")
1654 || Die "Failed to open file '$option_remote_host:$filename': $!";
1655 }
16561524
1657 my @option_names = (1525 my @option_names = (
1658 "innodb_log_files_in_group",1526 "innodb_log_files_in_group",
@@ -1747,14 +1615,11 @@
1747 'incremental-lsn=s' => \$option_incremental_lsn,1615 'incremental-lsn=s' => \$option_incremental_lsn,
1748 'incremental-dir=s' => \$option_incremental_dir,1616 'incremental-dir=s' => \$option_incremental_dir,
1749 'extra-lsndir=s' => \$option_extra_lsndir,1617 'extra-lsndir=s' => \$option_extra_lsndir,
1750 'remote-host=s' => \$option_remote_host,
1751 'stream=s' => \$option_stream,1618 'stream=s' => \$option_stream,
1752 'rsync' => \$option_rsync,1619 'rsync' => \$option_rsync,
1753 'tmpdir=s' => \$option_tmpdir,1620 'tmpdir=s' => \$option_tmpdir,
1754 'no-lock' => \$option_no_lock,1621 'no-lock' => \$option_no_lock,
1755 'ibbackup=s' => \$option_ibbackup_binary,1622 'ibbackup=s' => \$option_ibbackup_binary,
1756 'scpopt=s' => \$option_scp_opt,
1757 'sshopt=s' => \$option_ssh_opt,
1758 'force-tar', => \$option_force_tar,1623 'force-tar', => \$option_force_tar,
1759 'parallel=i' => \$option_parallel,1624 'parallel=i' => \$option_parallel,
1760 'safe-slave-backup' => \$option_safe_slave_backup,1625 'safe-slave-backup' => \$option_safe_slave_backup,
@@ -1829,8 +1694,8 @@
1829 }1694 }
1830 }1695 }
18311696
1832 if ($option_rsync && ($option_remote_host || $option_stream)) {1697 if ($option_rsync && ($option_stream)) {
1833 print STDERR "--rsync doesn't work with --remote-host or --stream\n";1698 print STDERR "--rsync doesn't work with --stream\n";
1834 exit(1);1699 exit(1);
1835 }1700 }
18361701
@@ -1858,11 +1723,8 @@
18581723
1859 $dir .= '/' . strftime("%Y-%m-%d_%H-%M-%S", localtime())1724 $dir .= '/' . strftime("%Y-%m-%d_%H-%M-%S", localtime())
1860 unless $option_no_timestamp;1725 unless $option_no_timestamp;
1861 if (!$option_remote_host) {1726
1862 mkdir($dir, 0777) || Die "Failed to create backup directory $dir: $!";1727 mkdir($dir, 0777) || Die "Failed to create backup directory $dir: $!";
1863 } else {
1864 system("ssh $option_ssh_opt $option_remote_host mkdir $dir");
1865 }
18661728
1867 # create subdirectories for ibdata files if needed1729 # create subdirectories for ibdata files if needed
1868# foreach my $a (split(/;/, $innodb_data_file_path)) {1730# foreach my $a (split(/;/, $innodb_data_file_path)) {
@@ -1898,16 +1760,10 @@
1898 $path = $root;1760 $path = $root;
1899 foreach $a (@{$relative_path}) {1761 foreach $a (@{$relative_path}) {
1900 $path = $path . "/" . $a;1762 $path = $path . "/" . $a;
1901 if (!$option_remote_host) {1763 if (! -d $path) {
1902 if (! -d $path) {1764 # this directory does not exist, create it !
1903 # this directory does not exist, create it !1765 mkdir($path, 0777) || Die "Failed to create backup directory: $!";
1904 mkdir($path, 0777) || Die "Failed to create backup directory: $!";1766 }
1905 }
1906 } else {
1907 if (system("ssh $option_ssh_opt $option_remote_host test -d $path") != 0) {
1908 system("ssh $option_ssh_opt $option_remote_host mkdir $path");
1909 }
1910 }
1911 }1767 }
1912}1768}
19131769
@@ -1982,23 +1838,17 @@
1982 while (defined($database = readdir(DIR))) {1838 while (defined($database = readdir(DIR))) {
1983 my $print_each_file = 0;1839 my $print_each_file = 0;
1984 my $file_c;1840 my $file_c;
1985 my @scp_files;
1986 # skip files that are not database directories1841 # skip files that are not database directories
1987 if ($database eq '.' || $database eq '..') { next; }1842 if ($database eq '.' || $database eq '..') { next; }
1988 next unless -d "$source_dir/$database";1843 next unless -d "$source_dir/$database";
1989 next unless check_if_required($database);1844 next unless check_if_required($database);
1990 1845
1991 if (!$option_remote_host && !$option_stream) {1846 if (!$option_stream) {
1992 if (! -e "$backup_dir/$database") {1847 if (! -e "$backup_dir/$database") {
1993 # create database directory for the backup1848 # create database directory for the backup
1994 mkdir("$backup_dir/$database", 0777)1849 mkdir("$backup_dir/$database", 0777)
1995 || Die "Couldn't create directory '$backup_dir/$database': $!";1850 || Die "Couldn't create directory '$backup_dir/$database': $!";
1996 }1851 }
1997 } elsif ($option_remote_host) {
1998 if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/$database")
1999 != 0) {
2000 system("ssh $option_ssh_opt $option_remote_host mkdir $backup_dir/$database");
2001 }
2002 }1852 }
20031853
2004 # copy files of this database1854 # copy files of this database
@@ -2032,15 +1882,12 @@
2032 if (!$prep_mode) {1882 if (!$prep_mode) {
2033 $rsync_files_hash{"$database/$file"} = 1;1883 $rsync_files_hash{"$database/$file"} = 1;
2034 }1884 }
2035 } elsif (!$option_remote_host && !$option_stream) {1885 } elsif (!$option_stream) {
2036 $src_name = escape_path("$source_dir/$database/$file");1886 $src_name = escape_path("$source_dir/$database/$file");
2037 $dst_name = escape_path("$backup_dir/$database");1887 $dst_name = escape_path("$backup_dir/$database");
2038 # Copy the file - If we get an error and the file actually exists, die with error msg1888 # Copy the file - If we get an error and the file actually exists, die with error msg
2039 copy_if_exists("$src_name", "$dst_name")1889 copy_if_exists("$src_name", "$dst_name")
2040 or Die "Failed to copy file '$file': $!";1890 or Die "Failed to copy file '$file': $!";
2041 } elsif ($option_remote_host) {
2042 # Queue up files for one single scp per database.
2043 push(@scp_files, "'$file'");
2044 } elsif($option_stream) {1891 } elsif($option_stream) {
2045 my $ret = 0;1892 my $ret = 0;
2046 my $file_name = substr($file, rindex($file, '/') + 1);1893 my $file_name = substr($file, rindex($file, '/') + 1);
@@ -2061,11 +1908,6 @@
2061 }1908 }
2062 }1909 }
2063 }1910 }
2064 if ($option_remote_host and @scp_files) {
2065 my $scp_file_list = join(" ", map { "$source_dir/$database/$_" } @scp_files);
2066 system("scp $option_scp_opt $scp_file_list '$option_remote_host:$backup_dir/$database/'")
2067 and Die "Failed to execute \"scp $option_scp_opt $scp_file_list '$option_remote_host:$backup_dir/$database/'\": $!";
2068 }
2069 }1911 }
2070 closedir(DIR);1912 closedir(DIR);
20711913
@@ -2622,9 +2464,8 @@
2622 [--password=WORD] [--port=PORT] [--socket=SOCKET]2464 [--password=WORD] [--port=PORT] [--socket=SOCKET]
2623 [--no-timestamp] [--ibbackup=IBBACKUP-BINARY]2465 [--no-timestamp] [--ibbackup=IBBACKUP-BINARY]
2624 [--slave-info] [--stream=tar|xbstream] [--force-tar]2466 [--slave-info] [--stream=tar|xbstream] [--force-tar]
2625 [--scpopt=OPTIONS-FOR-SCP] [--sshopt=OPTIONS-FOR-SSH]
2626 [--defaults-file=MY.CNF]2467 [--defaults-file=MY.CNF]
2627 [--databases=LIST] [--remote-host=HOSTNAME] [--no-lock] 2468 [--databases=LIST] [--no-lock]
2628 [--tmpdir=DIRECTORY] [--tables-file=FILE]2469 [--tmpdir=DIRECTORY] [--tables-file=FILE]
2629 [--incremental] [--incremental-basedir]2470 [--incremental] [--incremental-basedir]
2630 [--incremental-dir] [--incremental-lsn]2471 [--incremental-dir] [--incremental-lsn]
@@ -2770,10 +2611,6 @@
27702611
2771This option is passed directly to xtrabackup's --apply-log-only option. This forces xtrabackup to skip the "rollback" phase and do a "redo" only. This is necessary if the backup will have incremental changes applied to it later. See the xtrabackup documentation for details. 2612This option is passed directly to xtrabackup's --apply-log-only option. This forces xtrabackup to skip the "rollback" phase and do a "redo" only. This is necessary if the backup will have incremental changes applied to it later. See the xtrabackup documentation for details.
27722613
2773=item --remote-host=HOSTNAME
2774
2775This option specifies the remote host on which the backup files will be created, by using an ssh connection. The option accepts a string argument.
2776
2777=item --safe-slave-backup2614=item --safe-slave-backup
27782615
2779Stop slave SQL thread and wait to start backup until Slave_open_temp_tables in "SHOW STATUS" is zero. If there are no open temporary tables, the backup will take place, otherwise the SQL thread will be started and stopped until there are no open temporary tables. The backup will fail if Slave_open_temp_tables does not become zero after --safe-slave-backup-timeout seconds. The slave SQL thread will be restarted when the backup finishes.2616Stop slave SQL thread and wait to start backup until Slave_open_temp_tables in "SHOW STATUS" is zero. If there are no open temporary tables, the backup will take place, otherwise the SQL thread will be started and stopped until there are no open temporary tables. The backup will fail if Slave_open_temp_tables does not become zero after --safe-slave-backup-timeout seconds. The slave SQL thread will be restarted when the backup finishes.
@@ -2782,14 +2619,6 @@
27822619
2783How many seconds --safe-slave-backup should wait for Slave_open_temp_tables to become zero. (default 300)2620How many seconds --safe-slave-backup should wait for Slave_open_temp_tables to become zero. (default 300)
27842621
2785=item --scpopt=SCP-OPTIONS
2786
2787This option specifies the command line options to pass to scp when the option --remost-host is specified. The option accepts a string argument. If the option is not specified, the default options are "-Cp -c arcfour".
2788
2789=item --sshopt=SSH-OPTIONS
2790
2791This option specifies the command line options to pass to ssh when the option --remost-host is specified. The option accepts a string argument.
2792
2793=item --slave-info2622=item --slave-info
27942623
2795This option is useful when backing up a replication slave server. It prints the binary log position and name of the master server. It also writes this information to the "xtrabackup_slave_info" file as a "CHANGE MASTER" command. A new slave for this master can be set up by starting a slave server on this backup and issuing a "CHANGE MASTER" command with the binary log position saved in the "xtrabackup_slave_info" file.2624This option is useful when backing up a replication slave server. It prints the binary log position and name of the master server. It also writes this information to the "xtrabackup_slave_info" file as a "CHANGE MASTER" command. A new slave for this master can be set up by starting a slave server on this backup and issuing a "CHANGE MASTER" command with the binary log position saved in the "xtrabackup_slave_info" file.
@@ -2812,7 +2641,7 @@
28122641
2813=item --tmpdir=DIRECTORY2642=item --tmpdir=DIRECTORY
28142643
2815This option specifies the location where a temporary file will be stored. The option accepts a string argument. It should be used when --remote-host or --stream is specified. For these options, the transaction log will first be stored to a temporary file, before streaming or copying to a remote host. This option specifies the location where that temporary file will be stored. If the option is not specifed, the default is to use the value of tmpdir read from the server configuration.2644This option specifies the location where a temporary file will be stored. The option accepts a string argument. It should be used when --stream is specified. For these options, the transaction log will first be stored to a temporary file, before streaming or copying to a remote host. This option specifies the location where that temporary file will be stored. If the option is not specifed, the default is to use the value of tmpdir read from the server configuration.
28162645
2817=item --use-memory=B2646=item --use-memory=B
28182647

Subscribers

People subscribed via source and target branches