共计 1484 个字符,预计需要花费 4 分钟才能阅读完成。
这篇来说说如何安全的备份,这里要讲的是主服务器如何推送数据实现备份。
一、备份服务器配置 rsync 文件 vi /etc/rsyncd.conf
uid = 0 | |
gid = 0 | |
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 | |
path = /backup | |
ignore errors | |
read only = false | |
list = false | |
hosts allow = 192.168.1.0/24 | |
auth users = rsync_backup | |
secrets file = /etc/rsync.password |
二、备份服务器配置虚拟用户的密码文件
[ | ]|
[ | ]|
rsync_backup:123456 | |
[ | ]
三、主服务器配置虚拟用户密码 并测试
[ | ]|
[ | ]|
123456 | |
[ | ]|
-rw------- 1 root root 7 4 月 22 14:32 /etc/rsync.password | |
[ | ]|
[ | ]|
hello itstyle | |
[ | ]|
sending incremental file list | |
test.txt | |
sent 82 bytes received 27 bytes 72.67 bytes/sec | |
total size is 13 speedup is 0.12 |
四、编写脚本
vi rsync_push.sh
rsync -az /home/tomcat8 rsync_backup@192.168.1.130::backup --password-file=/etc/rsync.password |
正文完
星哥玩云-微信公众号
