如何配置RSync文件备份同步Linux服务器
如何配置RSync文件备份同步Linux服务器
1.安装rsync服务器
yum install -y rsync
2.启动rsync服务器
systemctl start rsyncd
3.修改rsync配置文件
vim /etc/rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 200
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
secrets file = /etc/rsyncd.secrets
ignore errors
read only = false
list = false
hosts allow = 172.16.1.0/24
hosts deny = 0.0.0.0/0
auth users = backup
secrets file = /etc/rsyncd.secrets
4.创建rsync密码文件
vim /etc/rsyncd.secrets
backup:123456
5.创建备份目录
mkdir -p /data/backup
6.创建日志目录
mkdir -p /var/log/rsync
7.修改目录权限
chmod -R 755 /data/backup
8.配置防火墙
firewall-cmd --permanent --add-port=873/tcp
firewall-cmd --reload
9.查看rsync服务器状态
systemctl status rsyncd
10.安装rsync客户端
yum install -y rsync
11.备份文件
rsync -avzP -e 'ssh -p 22' root@172.16.1.100:/data/www /data/backup
12.查看备份结果
ll /data/backup
相关文章