Merge lp:~igor-tverdovskiy/percona-xtrabackup/ssh_opt into lp:percona-xtrabackup/2.0

Proposed by Igor Tverdovskiy
Status: Merged
Merged at revision: 317
Proposed branch: lp:~igor-tverdovskiy/percona-xtrabackup/ssh_opt
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 126 lines (+21/-15)
1 file modified
innobackupex (+21/-15)
To merge this branch: bzr merge lp:~igor-tverdovskiy/percona-xtrabackup/ssh_opt
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Needs Fixing
Review via email: mp+82093@code.launchpad.net

Description of the change

1)
Added new option --sshopt.

Allows you to specify options which directly transfer to ssh.

For example:
sudo innobackupex --no-timestamp --sshopt="-i /home/porta-one/.ssh/id_dsa" --remote-host="user@192.168.193.112" /var/tmp/backup --tmpdir=/var/tmp/backup --scpopt="-i /home/porta-one/.ssh/id_dsa"

Thus innobackupex won't ask you the password to remote host.

2)Fixed typo. --remost-host => --remote-host

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Igor,

Thank you for the contribution. The change itself looks good, but we now have XtraBackup docs stored in the source tree, so it would be great to have them updated along with introducing a new option. Take a look at the .rst files in doc/source/innobackupex.

review: Needs Fixing
Revision history for this message
Igor Tverdovskiy (igor-tverdovskiy) wrote :

Hi Alexey,

ok, I'll check this.

Revision history for this message
Igor Tverdovskiy (igor-tverdovskiy) wrote :

Dear Alexey,

As I can see my modifications have been already added.
http://bazaar.launchpad.net/~percona-core/percona-xtrabackup/release-1.6/revision/317

So I'm changing status to merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'innobackupex'
--- innobackupex 2011-10-21 17:47:31 +0000
+++ innobackupex 2011-11-14 04:42:23 +0000
@@ -99,6 +99,7 @@
99my $option_tar4ibd = '';99my $option_tar4ibd = '';
100my $option_force_tar = '';100my $option_force_tar = '';
101my $option_scp_opt = '-Cp -c arcfour';101my $option_scp_opt = '-Cp -c arcfour';
102my $option_ssh_opt = '';
102103
103my $option_parallel = '';104my $option_parallel = '';
104105
@@ -268,7 +269,7 @@
268 $ibbackup_exit_code = backup();269 $ibbackup_exit_code = backup();
269 if ($option_remote_host) {270 if ($option_remote_host) {
270 open(XTRABACKUP_BINARY,271 open(XTRABACKUP_BINARY,
271 "| ssh $option_remote_host 'cat > $backup_dir/$xtrabackup_binary_file'")272 "| ssh $option_ssh_opt $option_remote_host 'cat > $backup_dir/$xtrabackup_binary_file'")
272 || die "Failed to open file '$option_remote_host:$backup_dir/$xtrabackup_binary_file': $!";273 || die "Failed to open file '$option_remote_host:$backup_dir/$xtrabackup_binary_file': $!";
273 } elsif ($option_stream) {274 } elsif ($option_stream) {
274 open XTRABACKUP_BINARY, "> $option_tmpdir/$xtrabackup_binary_file"275 open XTRABACKUP_BINARY, "> $option_tmpdir/$xtrabackup_binary_file"
@@ -821,10 +822,10 @@
821 my @list;822 my @list;
822823
823 if($option_remote_host) {824 if($option_remote_host) {
824 if (system("ssh $option_remote_host test -e $backup_dir/ib_logfile0")825 if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/ib_logfile0")
825 == 0) {826 == 0) {
826 print STDERR "$prefix Remove $option_remote_host:$backup_dir/ib_logfile*\n";827 print STDERR "$prefix Remove $option_remote_host:$backup_dir/ib_logfile*\n";
827 system("ssh $option_remote_host rm $backup_dir/ib_logfile\*")828 system("ssh $option_ssh_opt $option_remote_host rm $backup_dir/ib_logfile\*")
828 and Die "Failed to rm file '$backup_dir/ib_logfile*': $!";829 and Die "Failed to rm file '$backup_dir/ib_logfile*': $!";
829 }830 }
830 }831 }
@@ -911,9 +912,9 @@
911 print STDERR "$prefix Backing up file '$file'\n";912 print STDERR "$prefix Backing up file '$file'\n";
912 }913 }
913 if($option_remote_host) {914 if($option_remote_host) {
914 if (system("ssh $option_remote_host test -e $backup_dir/$subdir")915 if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/$subdir")
915 != 0) {916 != 0) {
916 system("ssh $option_remote_host mkdir $backup_dir/$subdir");917 system("ssh $option_ssh_opt $option_remote_host mkdir $backup_dir/$subdir");
917 }918 }
918 system("scp $option_scp_opt '$file' '$option_remote_host:$backup_dir/$subdir/'")919 system("scp $option_scp_opt '$file' '$option_remote_host:$backup_dir/$subdir/'")
919 and Die "Failed to scp file '$file': $!";920 and Die "Failed to scp file '$file': $!";
@@ -1129,7 +1130,7 @@
1129 open(FILE, ">$binlog_info") || 1130 open(FILE, ">$binlog_info") ||
1130 Die "Failed to open file '$binlog_info': $!";1131 Die "Failed to open file '$binlog_info': $!";
1131 } else {1132 } else {
1132 open(FILE, "| ssh $option_remote_host 'cat > $binlog_info'") ||1133 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $binlog_info'") ||
1133 Die "Failed to open file '$option_remote_host:$binlog_info': $!";1134 Die "Failed to open file '$option_remote_host:$binlog_info': $!";
1134 }1135 }
1135 print FILE "$info_lines[1]\n";1136 print FILE "$info_lines[1]\n";
@@ -1182,7 +1183,7 @@
1182 open(FILE, ">$slave_info") || 1183 open(FILE, ">$slave_info") ||
1183 Die "Failed to open file '$slave_info': $!";1184 Die "Failed to open file '$slave_info': $!";
1184 } else {1185 } else {
1185 open(FILE, "| ssh $option_remote_host 'cat > $slave_info'") ||1186 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $slave_info'") ||
1186 Die "Failed to open file '$option_remote_host:$slave_info': $!";1187 Die "Failed to open file '$option_remote_host:$slave_info': $!";
1187 }1188 }
1188 print FILE "CHANGE MASTER TO MASTER_LOG_FILE='$filename', MASTER_LOG_POS=$position\n";1189 print FILE "CHANGE MASTER TO MASTER_LOG_FILE='$filename', MASTER_LOG_POS=$position\n";
@@ -1519,8 +1520,8 @@
1519 $root = $backup_dir;1520 $root = $backup_dir;
1520 open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";1521 open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";
1521 } else {1522 } else {
1522 $root = `ssh $option_remote_host 'cd $backup_dir; pwd'`;1523 $root = `ssh $option_ssh_opt $option_remote_host 'cd $backup_dir; pwd'`;
1523 open(FILE, "| ssh $option_remote_host 'cat > $filename'")1524 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $filename'")
1524 || Die "Failed to open file '$option_remote_host:$filename': $!";1525 || Die "Failed to open file '$option_remote_host:$filename': $!";
1525 }1526 }
15261527
@@ -1608,6 +1609,7 @@
1608 'no-lock' => \$option_no_lock,1609 'no-lock' => \$option_no_lock,
1609 'ibbackup=s' => \$option_ibbackup_binary,1610 'ibbackup=s' => \$option_ibbackup_binary,
1610 'scpopt=s' => \$option_scp_opt,1611 'scpopt=s' => \$option_scp_opt,
1612 'sshopt=s' => \$option_ssh_opt,
1611 'force-tar', => \$option_force_tar,1613 'force-tar', => \$option_force_tar,
1612 'parallel=i' => \$option_parallel,1614 'parallel=i' => \$option_parallel,
1613 'safe-slave-backup' => \$option_safe_slave_backup,1615 'safe-slave-backup' => \$option_safe_slave_backup,
@@ -1727,7 +1729,7 @@
1727 if (!$option_remote_host) {1729 if (!$option_remote_host) {
1728 mkdir($dir, 0777) || Die "Failed to create backup directory $dir: $!";1730 mkdir($dir, 0777) || Die "Failed to create backup directory $dir: $!";
1729 } else {1731 } else {
1730 system("ssh $option_remote_host mkdir $dir");1732 system("ssh $option_ssh_opt $option_remote_host mkdir $dir");
1731 }1733 }
17321734
1733 # create subdirectories for ibdata files if needed1735 # create subdirectories for ibdata files if needed
@@ -1770,8 +1772,8 @@
1770 mkdir($path, 0777) || Die "Failed to create backup directory: $!";1772 mkdir($path, 0777) || Die "Failed to create backup directory: $!";
1771 }1773 }
1772 } else {1774 } else {
1773 if (system("ssh $option_remote_host test -d $path") != 0) {1775 if (system("ssh $option_ssh_opt $option_remote_host test -d $path") != 0) {
1774 system("ssh $option_remote_host mkdir $path");1776 system("ssh $option_ssh_opt $option_remote_host mkdir $path");
1775 }1777 }
1776 }1778 }
1777 }1779 }
@@ -1834,9 +1836,9 @@
1834 || Die "Couldn't create directory '$backup_dir/$database': $!";1836 || Die "Couldn't create directory '$backup_dir/$database': $!";
1835 }1837 }
1836 } elsif ($option_remote_host) {1838 } elsif ($option_remote_host) {
1837 if (system("ssh $option_remote_host test -e $backup_dir/$database")1839 if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/$database")
1838 != 0) {1840 != 0) {
1839 system("ssh $option_remote_host mkdir $backup_dir/$database");1841 system("ssh $option_ssh_opt $option_remote_host mkdir $backup_dir/$database");
1840 }1842 }
1841 }1843 }
18421844
@@ -2527,7 +2529,11 @@
25272529
2528=item --scpopt=SCP-OPTIONS2530=item --scpopt=SCP-OPTIONS
25292531
2530This 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".2532This option specifies the command line options to pass to scp when the option --remote-host is specified. The option accepts a string argument. If the option is not specified, the default options are "-Cp -c arcfour".
2533
2534=item --sshopt=SSH-OPTIONS
2535
2536This option specifies the command line options to pass to ssh (e.g. "-i $path_to_id_dsa_key" in order to avoid password request). The option accepts a string argument. There are no options specified by default.
25312537
2532=item --slave-info2538=item --slave-info
25332539

Subscribers

People subscribed via source and target branches