标签:res rto 使用 uid err exclude read 环境 vim
环境:
192.168.1.3 备份服务器 centos 7.7
在linux环境下,以centos为例,安装非常简单:
[root@qinshengfei ~]# yum install rsync
rsync 服务端安装完成之后是没有生成rsync.conf文件的,需要手动创建rsyncd.conf
[root@qinshengfei ~]# vim /etc/rsyncd.conf
#先定义整体变量
secrets file = /etc/rsyncd.secrets #配置同步用户名和密码
motd file = /etc/rsyncd.motd
read only = yes
list = yes
#uid = nobody
#gid = nobody
uid = root
gid = root
hosts allow = * ? ?#哪些电脑可以访问rsync服务
hosts deny = 0.0.0.0/32 ? ?#哪些电脑不可以访问rsync服务
max connections = 2
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
#再定义要rsync的目录
[backup]
path = /data/app/files
list=yes
ignore errors
auth users = root
comment = welcome
exclude = file1/ ?file2/?
[root@qinshengfei ~]# vim /etc/rsyncd.secrets
root:123456
[root@qinshengfei ~]# rsync -arzvtopg --delete feng@192.168.1.2::bakup /opt/app/bakdir --password-file=/etc/rsyncd.secrets
在linux环境下,可以使用crontab和rsync结合起来做备份机制,找到/etc/crontab文件,在文件里追加这样一行
[root@qinshengfei ~]# vim /etc/crontab
40 19 * * * root rsync -aqzrtopg --progress root@192.168.1.2::backup /opt/app/bakdir --password-file=/etc/rsyncd.secrets --log-file=/var/log/rsync.log
释义:前面两个参数配置是:每天19:40定时同步
标签:res rto 使用 uid err exclude read 环境 vim
原文地址:https://www.cnblogs.com/qinshengfei/p/12149158.html