RockyLinux下Rsync Server安装和配置

rsync简介

rsync是一款快速的,开源的,多功能的,可以实现全量和增量的远程和本地的数据同步和数据备份的工具。

二、安装

1.查看是否安装

rpm -qa | grep rsync

2.安装

dnf install -y rsync

3.配置rsync服务端的配置文件

3.1 rsyncd.conf
vim /etc/rsyncd.conf
uid = root
gid = root
port = 9600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
hosts allow = *
read only    = true
use chroot = false
strict modes = false

[image]    
path = /var/www/test
transfer logging = yes
auth users = gb
secrets file = /var/www/rsyncConf/auth.passwd
3.2 auth.passwd格式
gb:123456
3.3 设置auth.passwd权限600
chmod -c 600 auth.passwd

三、用systemctl管理rsync服务

1.创建一个配置文件

vim /etc/sysconfig/rsyncd
OPTIONS=""

2.创建service文件

vim /lib/systemd/system/rsyncd.service
[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf

[Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"

[Install]
WantedBy=multi-user.target

3.加入开启启动项

systemctl enable rsyncd

4. 启动

systemctl start rsyncd
systemctl status rsyncd

四、rsync客户端同步

 rsync.exe -avzP --progress --delete --port=9600 --password-file=/cygdrive/d/auth.passwd  [email protected]::image /cygdrive/d/test_rsync 
 

参考链接:centos8环境安装配置rsync - 刘宏缔的架构森林 - 博客园 (cnblogs.com)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章