linux Sersync 上配置客户端

1、安装 Rsync 并配置相关权限

 

在 SERSYNC 上配置 RSYNC 客户端相关权限认证:

 

 

[root@SERSYNC /]# yum install rsync -y

 

 

[root@SERSYNC /]# echo "redhat" > /etc/rsync.password

 

 

[root@SERSYNC /]# chmod 600 /etc/rsync.password

 

[root@SERSYNC /]# cat /etc/rsync.password

 

Redhat

 

[root@SERSYNC ~]# ll /etc/rsync.password

 

-rw-------. 1 root root 7 Jun 4 00:20 /etc/rsync.password

 

2、在 SERSYNC 上手动测试 rsync 的同步情况

 

特别强调:此步很关键,如果这不能同步,后面的 SERSYNC 配好了也不会同步数据。

 

1分别创建待同步数据

 

 

[root@SERSYNC ~]# touch /data/{web/index.html,download/a.jpg}

 

[root@SERSYNC ~]# tree /data

 

/data

 

├── download

 

│  └── a.jpg

 

└── web

 

 

└── index.html

 

 

2 directories, 2 files

 

3执行同步命令

 

针对 SWEB1(172.16.100.1):

 

 

[root@SERSYNC ~]# rsync -avzP /data/web rsync_bak@172.16.100.1::web/ --password-fil

 

 

e=/etc/rsync.password

 

 

sending incremental file list

 

 

web/

 

 

web/index.html

 

 

0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=0/2)

 

 

sent 92 bytes received 31 bytes 246.00 bytes/sec

 

 

total size is 0 speedup is 0.00

 

 

[root@SERSYNC ~]# rsync -avzP /data/download/ rsync_bak@172.16.100.1::download/ --

 

 

password-file=/etc/rsync.password

 

sending incremental file list

 

./

 

a.jpg

 

0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=0/2)

 

sent 75 bytes received 30 bytes 210.00 bytes/sec total size is 0 speedup is 0.00

 

 

[root@SERSYNC ~]# rsync -avzP /data/web rsync_bak@172.16.100.2::web/ --password-fil

 

e=/etc/rsync.password sending incremental file list web/

web/index.html

 

0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=0/2)

 

 

sent 92 bytes received 31 bytes 246.00 bytes/sec

 

 

total size is 0 speedup is 0.00

 

 

[root@SERSYNC ~]# rsync -avzP /data/download/ rsync_bak@172.16.100.2::download/ --

 

 

password-file=/etc/rsync.password

 

 

sending incremental file list

 

 

./

 

 

a.jpg

 

 

0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=0/2)

 

 

sent 75 bytes received 30 bytes 70.00 bytes/sec

 

 

total size is 0 speedup is 0.0

步完之后,分别对 SWEB1,SWEB2 的相应目录进行查看!此处以 SWEB1 为例:提示: 在后面进行部署 SERSYNC 之前,SERSYNC 主服务器(即 SERSYNC)上必须要确保手动可以把 文件推送到 SWEB1,SWEB2 上,这样后续 SERSYNC 才能调用这些命令来自动推送。

 

 

[root@SWEB1 ~]# tree /data/

 

/data/

 

├── download

 

│  └── a.jpg

 

└── web

 

└── web

 

└── index.html

posted @ 2019-08-09 15:15  樊伟胜  阅读(143)  评论(0编辑  收藏  举报