云计算学习路线教程大纲课件:tar项目实战案例:
====================================================================================
[[email protected] ~]# yum -y install mariadb-server
[[email protected] ~]# systemctl start mariadb
[[email protected] ~]# mkdir /backup
案例1:mysql物理备份及恢复
[[email protected] ~]# tar -cJf /backup/mysql.tar.xz /var/lib/mysql
[[email protected] ~]# rm -rf /var/lib/mysql/*
[[email protected] ~]# tar -xf /backup/mysql.tar.xz -C /
案例2:mysql物理备份及恢复
[[email protected] ~]# cd /var/lib/mysql
[[email protected] mysql]# tar -cJf /backup/mysql.tar.xz *
[[email protected] mysql]# tar -xf /backup/mysql.tar.xz -C /var/lib/mysql
案例3:host A /etc (海量小文件) --------> host A /tmp
[[email protected] ~]# tar -czf etc.gz /etc -C /tmp
案例4:host A /etc (海量小文件) --------> host B /tmp
常规方法:
[[email protected] ~]# scp -r /etc 172.16.20.21:/tmp
建议方法:
==host B 监听端口==
[[email protected]_hat ~]# firewall-cmd --permanent --add-port=8888/tcp
[[email protected]_hat ~]# firewall-cmd --reload
或
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# nc -l 8888 |tar -xzf - -C /tmp
==host A ==
[[email protected] ~]# tar -czf - /etc | nc 172.16.20.21 8888
tar: Removing leading `/‘ from member names
====================================================================================
原文地址:https://blog.51cto.com/14529670/2439733