数据同步rsync的部署

1.下载安装rsync

[root@rsync-41 ~]# yum install rsync -y

2.编辑rsync的配置文件

[root@rsync-41 ~]# vim /etc/rsyncd.conf 


uid = www 
uid = www
gid = www 
port = 873
fake super = yes
use chroot = no
max connections = 200
timeout = 600
ignore errors
read only = false
list = false
auth users = rsync_backup
secrets file = /etc/rsync.passwd 
log file = /var/log/rsyncd.log
#####################################
[backup]
comment = about rsync
path = /backup

[data]
comment = this is secord backup dir,to website data..
path = /data

3.给rsync创建登录用户

[root@rsync-41 ~]# useradd www -M -s /sbin/nologin

4.创建对应的数据共享文件夹

[root@rsync-41 ~]# mkdir /{backup,data}

5.修改文件夹的属主属组

[root@rsync-41 ~]# chown www.www /backup
[root@rsync-41 ~]# chown www.www /data
[root@rsync-41 ~]# ll -d /backup/
drwxr-xr-x 2 www www 6 Aug  8 20:43 /backup/
[root@rsync-41 ~]# ll -d /data
drwxr-xr-x 2 www www 6 Aug  8 20:43 /data

6.生成密码验证文件

[root@rsync-41 ~]# echo 'rsync_backup:123456' > /etc/rsync.passwd

7.修改密码验证文件的权限为600

[root@rsync-41 ~]# ll -d /etc/rsync.passwd 
-rw------- 1 root root 20 Aug  8 20:46 /etc/rsync.passwd

8.启动rsync服务并查看运行状态

[root@rsync-41 ~]# systemctl start rsyncd
[root@rsync-41 ~]# systemctl status rsyncd
● rsyncd.service - fast remote file copy program daemon
   Loaded: loaded (/usr/lib/systemd/system/rsyncd.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2024-08-08 20:49:14 CST; 5s ago
 Main PID: 1291 (rsync)
   CGroup: /system.slice/rsyncd.service
           └─1291 /usr/bin/rsync --daemon --no-detach

Aug 08 20:49:14 rsync-41 systemd[1]: Started fast remote file copy program daemon.
Aug 08 20:49:14 rsync-41 systemd[1]: Starting fast remote file copy program daemon...
Aug 08 20:49:14 rsync-41 rsyncd[1291]: params.c:Parameter() - Ignoring badly formed line in config file: ignore errors
Aug 08 20:49:14 rsync-41 rsyncd[1291]: rsyncd version 3.1.2 starting, listening on port 873

9.找另一台机器测试数据是否可以传输

nfs机器向rsync发送数据
[root@nfs-31 ~]# rsync -avzP /test/   rsync_backup@192.168.186.41::backup
Password: 
sending incremental file list


rsync接收到数据
[root@rsync-41 ~]# ls /backup/
10.log  13.log  16.log  19.log  21.log  24.log  27.log  2.log   32.log  35.log  38.log  40.log  43.log  46.log  49.log  5.log  8.log
11.log  14.log  17.log  1.log   22.log  25.log  28.log  30.log  33.log  36.log  39.log  41.log  44.log  47.log  4.log   6.log  9.log
12.log  15.log  18.log  20.log  23.log  26.log  29.log  31.log  34.log  37.log  3.log   42.log  45.log  48.log  50.log  7.log

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值