rsync server installation and configuration
introduce
rsyncd service, data transmission between different hosts
Features :
- rsync is a service and a command
- Easy to use, with multiple modes
- When transferring data, it is an incremental transfer.
全量: 无论多少数据 全部 推送走.
增量: 只会把 修改,新建 了的文件传输走
Rsync usage patterns
model | Application Scenario |
---|---|
local mode | not recommended |
remote mode | Transfer data (scp can be used instead for temporary use) |
rsync daemon mode (daemon) | Transfer data (no password required), used for timing backup and timing synchronization |
推送 rsync 路径名 远程的账户@IP:路径名
拉取 rsync 远程的账户@IP:路径名 路径名
server configuration
Check if installed
rpm -qa | grep rsync
check package contents
/etc/rsyncd.conf配置文件(服务端配置文件,守护进程模式)
/usr/bin/rsyncrsync命令
/usr/lib/systemd/system/rsyncd.servicesystemctl控制rsyncd服务的配置文件
configuration class
[root@quanheng ~]# cat /etc/rsyncd.conf
#create quanheng rsync 14:18 2022-8-27
#rsyncd.conf start
fake super =yes
uid = rsync
gid = rsync
use chroot = no
max connections = 2000
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = false
list = false
#hosts allow = 10.0.0.0/24
#hosts deny = 0.0.0.0/32
auth users = rsync_backup
secrets file = /etc/rsync.password #####################################
[data]
comment = create quanheng rsync 14:18 2022-8-27
path = data
#启动服务
systemctl enable rsyncd && systemctl start rsyncd
检查进程
ps -ef |grep rsync
#检查端口
ss -lntup |grep rsync
create username
#Add virtual user
useradd -s /sbin/nologin -M rsync
# create password fileecho 'rsync_backup:123 ’ >/etc/rsync.password
chmod 600 /etc/rsync.password
Client creates ciphertext
echo 123 >/etc/client.rsync
chmod 600 /etc/client.rsync
verify transmission
rsync -avzP /quanheng/ rsync@IP::data --password-file=/etc/client.rsync
Error solution
This is insufficient permission to add server file permission 755 755不行就777
or the firewall is not turned off the cloud service, the gateway may not be set or selinux is not turned off
This is a permission account problem.
Check whether the rsync.password on the server side is configured correctly.