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
1=== modified file 'innobackupex'
2--- innobackupex 2011-10-21 17:47:31 +0000
3+++ innobackupex 2011-11-14 04:42:23 +0000
4@@ -99,6 +99,7 @@
5 my $option_tar4ibd = '';
6 my $option_force_tar = '';
7 my $option_scp_opt = '-Cp -c arcfour';
8+my $option_ssh_opt = '';
9
10 my $option_parallel = '';
11
12@@ -268,7 +269,7 @@
13 $ibbackup_exit_code = backup();
14 if ($option_remote_host) {
15 open(XTRABACKUP_BINARY,
16- "| ssh $option_remote_host 'cat > $backup_dir/$xtrabackup_binary_file'")
17+ "| ssh $option_ssh_opt $option_remote_host 'cat > $backup_dir/$xtrabackup_binary_file'")
18 || die "Failed to open file '$option_remote_host:$backup_dir/$xtrabackup_binary_file': $!";
19 } elsif ($option_stream) {
20 open XTRABACKUP_BINARY, "> $option_tmpdir/$xtrabackup_binary_file"
21@@ -821,10 +822,10 @@
22 my @list;
23
24 if($option_remote_host) {
25- if (system("ssh $option_remote_host test -e $backup_dir/ib_logfile0")
26+ if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/ib_logfile0")
27 == 0) {
28 print STDERR "$prefix Remove $option_remote_host:$backup_dir/ib_logfile*\n";
29- system("ssh $option_remote_host rm $backup_dir/ib_logfile\*")
30+ system("ssh $option_ssh_opt $option_remote_host rm $backup_dir/ib_logfile\*")
31 and Die "Failed to rm file '$backup_dir/ib_logfile*': $!";
32 }
33 }
34@@ -911,9 +912,9 @@
35 print STDERR "$prefix Backing up file '$file'\n";
36 }
37 if($option_remote_host) {
38- if (system("ssh $option_remote_host test -e $backup_dir/$subdir")
39+ if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/$subdir")
40 != 0) {
41- system("ssh $option_remote_host mkdir $backup_dir/$subdir");
42+ system("ssh $option_ssh_opt $option_remote_host mkdir $backup_dir/$subdir");
43 }
44 system("scp $option_scp_opt '$file' '$option_remote_host:$backup_dir/$subdir/'")
45 and Die "Failed to scp file '$file': $!";
46@@ -1129,7 +1130,7 @@
47 open(FILE, ">$binlog_info") ||
48 Die "Failed to open file '$binlog_info': $!";
49 } else {
50- open(FILE, "| ssh $option_remote_host 'cat > $binlog_info'") ||
51+ open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $binlog_info'") ||
52 Die "Failed to open file '$option_remote_host:$binlog_info': $!";
53 }
54 print FILE "$info_lines[1]\n";
55@@ -1182,7 +1183,7 @@
56 open(FILE, ">$slave_info") ||
57 Die "Failed to open file '$slave_info': $!";
58 } else {
59- open(FILE, "| ssh $option_remote_host 'cat > $slave_info'") ||
60+ open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $slave_info'") ||
61 Die "Failed to open file '$option_remote_host:$slave_info': $!";
62 }
63 print FILE "CHANGE MASTER TO MASTER_LOG_FILE='$filename', MASTER_LOG_POS=$position\n";
64@@ -1519,8 +1520,8 @@
65 $root = $backup_dir;
66 open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";
67 } else {
68- $root = `ssh $option_remote_host 'cd $backup_dir; pwd'`;
69- open(FILE, "| ssh $option_remote_host 'cat > $filename'")
70+ $root = `ssh $option_ssh_opt $option_remote_host 'cd $backup_dir; pwd'`;
71+ open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $filename'")
72 || Die "Failed to open file '$option_remote_host:$filename': $!";
73 }
74
75@@ -1608,6 +1609,7 @@
76 'no-lock' => \$option_no_lock,
77 'ibbackup=s' => \$option_ibbackup_binary,
78 'scpopt=s' => \$option_scp_opt,
79+ 'sshopt=s' => \$option_ssh_opt,
80 'force-tar', => \$option_force_tar,
81 'parallel=i' => \$option_parallel,
82 'safe-slave-backup' => \$option_safe_slave_backup,
83@@ -1727,7 +1729,7 @@
84 if (!$option_remote_host) {
85 mkdir($dir, 0777) || Die "Failed to create backup directory $dir: $!";
86 } else {
87- system("ssh $option_remote_host mkdir $dir");
88+ system("ssh $option_ssh_opt $option_remote_host mkdir $dir");
89 }
90
91 # create subdirectories for ibdata files if needed
92@@ -1770,8 +1772,8 @@
93 mkdir($path, 0777) || Die "Failed to create backup directory: $!";
94 }
95 } else {
96- if (system("ssh $option_remote_host test -d $path") != 0) {
97- system("ssh $option_remote_host mkdir $path");
98+ if (system("ssh $option_ssh_opt $option_remote_host test -d $path") != 0) {
99+ system("ssh $option_ssh_opt $option_remote_host mkdir $path");
100 }
101 }
102 }
103@@ -1834,9 +1836,9 @@
104 || Die "Couldn't create directory '$backup_dir/$database': $!";
105 }
106 } elsif ($option_remote_host) {
107- if (system("ssh $option_remote_host test -e $backup_dir/$database")
108+ if (system("ssh $option_ssh_opt $option_remote_host test -e $backup_dir/$database")
109 != 0) {
110- system("ssh $option_remote_host mkdir $backup_dir/$database");
111+ system("ssh $option_ssh_opt $option_remote_host mkdir $backup_dir/$database");
112 }
113 }
114
115@@ -2527,7 +2529,11 @@
116
117 =item --scpopt=SCP-OPTIONS
118
119-This 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".
120+This 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".
121+
122+=item --sshopt=SSH-OPTIONS
123+
124+This 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.
125
126 =item --slave-info
127

Subscribers

People subscribed via source and target branches