使用shell编写集群分发脚本

本文介绍了如何使用scp和rsync命令在集群环境中进行远程复制,详细阐述了两者之间的区别,并提供了集群脚本复制shell的实践案例,强调了rsync在效率上的优势。
摘要由CSDN通过智能技术生成

1.scp远程复制命令

scp可以实现对计算机的文件复制

 [root@hadoop03 hadoop]# scp -r /root/桌面/hadoop root@hadoop01:/root/桌面/
 a.txt                                        100%    5     0.0KB/s   00:00    
 b.txt                                        100%   49     0.1KB/s   00:00    
 [root@hadoop03 hadoop]#

把hadoop3的/root/桌面/hadoop路径下的文件复制到hadoop01的/root/桌面/上

2.rsync远程复制命令

 [root@hadoop03 hadoop]# scp -r /root/桌面/hadoop root@hadoop01:/root/桌面/
 a.txt                                        100%    5     0.0KB/s   00:00    
 b.txt                                        100%   49     0.1KB/s   00:00    
 [root@hadoop03 hadoop]# ^C
 [root@hadoop03 hadoop]# rsync -rvl /root/桌面/hadoop root@hadoop02:/root/桌面/
 sending incremental file list
 created directory /root/桌面
 hadoop/
 hadoop/a.txt
 hadoop/b.txt
 ​
 sent 215 bytes  received 54 bytes  538.00 bytes/sec
 total size is 54  speedup is 0.20

3.scp和rsyn

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值