原來ssh可以這樣用
1. remote file copy
拷貝文件時,如果文件很大,又不想影響網(wǎng)絡IO可以用pv工具進行流量控制
2. local script remote execute
這樣就不用把腳本拷貝到遠端去執(zhí)行了
參考:
1. remote file copy
[root@xen74v01 ~]# cat test.pl
#!/usr/bin/perl
print "eth0.74"=~/(\w+)/;
print "\n";
[root@xen74v01 ~]# cat test.pl | ssh 10.1.74.76 'cat - > /tmp/test.pl'
#!/usr/bin/perl
print "eth0.74"=~/(\w+)/;
print "\n";
[root@xen74v01 ~]# cat test.pl | ssh 10.1.74.76 'cat - > /tmp/test.pl'
拷貝文件時,如果文件很大,又不想影響網(wǎng)絡IO可以用pv工具進行流量控制
pv -L10m test.pl | ssh 10.1.74.76 'cat - > /tmp/test.pl'
這里pv的行為跟cat比較類似,但是支持IO流量控制,這里設置10M/s.2. local script remote execute
[root@xen74v01 ~]# cat test.pl
#!/usr/bin/perl
print "eth0.74"=~/(\w+)/;
print "\n";
[root@xen74v01 ~]# perl test.pl
eth0
[root@xen74v01 ~]# cat test.pl | ssh 10.1.74.76 'perl'
eth0
[root@xen74v01 ~]# ssh 10.1.74.76 'perl' < test.pl
eth0
#!/usr/bin/perl
print "eth0.74"=~/(\w+)/;
print "\n";
[root@xen74v01 ~]# perl test.pl
eth0
[root@xen74v01 ~]# cat test.pl | ssh 10.1.74.76 'perl'
eth0
[root@xen74v01 ~]# ssh 10.1.74.76 'perl' < test.pl
eth0
這樣就不用把腳本拷貝到遠端去執(zhí)行了
參考:
http://linux.icydog.net/ssh/piping.php
http://www.ivarch.com/programs/quickref/pv.shtml
http://www.mysqlperformanceblog.com/2009/05/20/hint-throttling-xtrabackup/