7.18 10.28-10.31

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了7.18 10.28-10.31相关的知识,希望对你有一定的参考价值。

10.28 rsync工具介绍

 

rsync是一个实用的同步工具

 

需求:A目录的数据实时更新,将A的数据拷贝到B目录,每隔一小时拷贝一次

使用cp命令:

1 A目录中找出最近1小时新增的内容拷贝到B(比较麻烦)

2 直接拷贝A目录的所有内容将B目录覆盖(浪费时间和磁盘IO

cp命令不适用

 

rsync可以实现增量更新(rsync只会同步新增和有内容变更的文件);

支持远程同步(将数据同步到不同ip的另一台机器上);

 

安装rsync

[[email protected] ~]# yum install -y rsync

 

passwd同步到tmp目录下并改名为1.txt

[[email protected] ~]# rsync -av /etc/passwd /tmp/1.txt

sending incremental file list

passwd

 

sent 938 bytes  received 35 bytes  1,946.00 bytes/sec

total size is 846  speedup is 0.87

-a 包含多个选项

-v 可视化,可以看到拷贝的过程

 

将文件同步到远程机器的特定目录

[[email protected] ~]# rsync -av /etc/passwd [email protected]192.168.31.128:/tmp/1234.txt

The authenticity of host '192.168.31.128 (192.168.31.128)' can't be established.

ECDSA key fingerprint is SHA256:0SErfGbbc3AfFcxC92Tav9X/T/bOn8wfnvum/wnw5Xs.

ECDSA key fingerprint is MD5:b7:d4:e4:4a:4a:33:29:99:1a:2e:45:94:d9:40:17:fb.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.31.128' (ECDSA) to the list of known hosts.

[email protected]'s password:

sending incremental file list

passwd

 

sent 938 bytes  received 35 bytes  67.10 bytes/sec

total size is 846  speedup is 0.87

其中[email protected]可以省略,此时使用执行当前命令的用户作为登录用户

 

将远程机器的某文件拷贝到当前机器某个目录下

[[email protected] ~]# rsync -av [email protected]:/etc/passwd /tmp/passwddd

[email protected]'s password:

receiving incremental file list

passwd

 

sent 43 bytes  received 938 bytes  130.80 bytes/sec

total size is 846  speedup is 0.86

[[email protected] ~]# ls /tmp/passwddd

/tmp/passwddd

 


以上是关于7.18 10.28-10.31的主要内容,如果未能解决你的问题,请参考以下文章

mysql5.7.18手动配置

7.18python进程池

MySQL5.7.18安装说明

总结7.18 laravel输入

docker 安装配置mysql5.7.18

mysql5.7.18字符集配置