1、案例3:host A /etc (海量小文件) --------> 本地主机host A /tmp
[root@localhost ~]# time tar -czf - /etc |tar -xzf - -C /tmp
注:- 表示不会真的写到硬盘中去,而是写在内存中去
2、案例4:host A /etc (海量小文件) --------> 远程主机host B /tmp
常规方法:scp直接远程拷贝或者是tar打包压缩之后远程拷贝
建议方法(不落地即不经过硬盘的方法):
==host B 监听端口==
如果host B的防火墙开着,需要添加新端口;如果防火墙是关着的不需要下面操作
[root@hostb ~]# firewall-cmd --permanent --add-port=8888/tcp
[root@hostb ~]# firewall-cmd --reload
在主机B上开启监听端口,接收到数据就进行解包的操作
[root@hostb ~]# nc -l -t 8888 |tar -xzf - -C /tmp
==host A ==
[root@localhost ~]# tar -czf - /etc | nc 172.16.20.21 8888
tar: Removing leading `/' from member names
错误分析:A 主机向B主机发送,不过内存
B 主机
[root@d-209 ~]# nc -l -t 8888 |tar -xzf - -C /tmp
A主机
[root@localhost ansible]# tar -czf - /etc/ansible/roles | nc 10.0.104.209 8888
tar: Removing leading `/' from member names
网友评论