rsync配置
服务器端:
cat /etc/rsyncd.conf :
uid = rsync gid = rsync use chroot = no max connections = 200 timeout = 300 pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log auth users = rsync_backup secrets file = /etc/rsync.password # [backup] comment = "backup" path = /backup ignore errors hosts allow = 10.0.0.0/24 list = false read only = false fake super = yes
启动rsync rsync --daemon
[root@k8s-master1 10.0.0.65]# chmod 644 /etc/rsync.password [root@k8s-master1 10.0.0.65]# cat /etc/rsync.password rsync_backup:123456
客户端:
echo 123456 >/root/client.pass chmod 644 /root/client.pass
rsync测试:
rsync -avz /backup/ rsync_backup@10.0.0.63::backup/$(hostname -i) --password-file=/root/client.pass
检查:
[root@k8s-master1 backup]# ls /backup/10.0.0.65/ access_log error.log
sersync 配置传送日志到服务器
- 创建密码文件
echo 123456 >/root/client.pass
- 修改配置
<sersync> <localpath watch="/var/log/nginx"> <remote ip="10.0.0.63" name="backup/$(hostname -i)"/> </localpath> <rsync> <!-- <commonParams params="-artuz"/> --> <commonParams params="-artuz"/> <auth start="true" users="rsync_backup" passwordfile="/root/client.pass"/> <userDefinedPort start="false" port="874"/><!-- port=874 --> <timeout start="false" time="100"/><!-- timeout=100 --> <ssh start="false"/> </rsync>
- 启动sersync
/usr/local/sersync/bin/sersync -dro /usr/local/sersync/conf/confxml.xml
- 测试日志同步