当前位置:网站首页>Centos7 Rsync + crontab scheduled backup
Centos7 Rsync + crontab scheduled backup
2020-11-10 10:41:00 【osc_8grrbqh4】
rsync Remote backup function
rsync Common options :
-v: Details output
-z: Compress during transmission --compress-level=NUM Can be compressed by level
-a: Archive mode transfers and preserves file properties equivalent to -rtopgDL
-r : Recursive mode
-t : Keep time attribute of file
-o: Keep the file primary
-p: Keep the file permission attribute
-g: Keep file group attribute
-D: Keep device file information
-l : Keep file soft links
-e: Using the specified protocol
–include=PATTERN: Specifies to exclude files that do not need to be transferred
–exclude-from=file: Read the exclusion from the file
-bwlimit=KBPS: Speed limit I / O bandwidth ; Per second KBytes
–delete: Delete files that do not exist in the source directory to make the target directory consistent with the source directory , Use with caution
crontab Cycle planning tasks
* * * * *
branch when Japan month Zhou
Prepare two virtual machine tests
192.168.27.137 Backup source
192.168.27.138 Backup side
Turn off the firewall setenforce
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
Backup source operation
install rsync
[root@localhost ~]# yum -y install rsync
Modify the configuration file
[root@localhost ~]# vim /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = yes
port 873
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
hosts allow = 192.168.27.0/24
[wwwroot]
path = /opt/aaa
comment = Document Root of www.51xit.top
read only =no
dont comperss = *.gz *.bz2 *.tgz *.zip *.rar *.z
auth users =tom
secrets file = /etc/rsyncd_users.db
[root@localhost ~]# mkdir /opt/aaa
Set up an account password
[root@localhost ~]# vim /etc/rsyncd_users.db
tom:123
Add authority
[root@localhost ~]# chmod 600 /etc/rsyncd_users.db
start-up rsync Check the port
root@localhost ~]# rsync --daemon
[root@localhost ~]# netstat -nlput |grep 873
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 13360/rsync
tcp6 0 0 :::873 :::* LISTEN 13360/rsync
Backup side operation
install rsync
[root@localhost ~]# yum -y install rsync
The backup only needs to set the user password
[root@localhost ~]# vim /etc/server.pass
123
Add authority
[root@localhost ~]# chmod 600 /etc/server.pass
Set timing task Execute every minute
[root@localhost ~]# crontab -e
* * * * * rsync -az --password-file=/etc/server.pass tom@192.168.27.137::wwwroot /root/
[root@localhost ~]# crontab -l
* * * * * rsync -az --password-file=/etc/server.pass tom@192.168.27.137::wwwroot /root/
test
Create a test on the backup side
[root@localhost aaa]# cd /opt/aaa/
[root@localhost aaa]# touch a
In the backup source, etc 1 Minutes to check Is it synchronized
[root@localhost ~]# ls
a
版权声明
本文为[osc_8grrbqh4]所创,转载请带上原文链接,感谢
边栏推荐
- 一不小心画了 24 张图剖析计网应用层协议!
- csdn bug11:待加
- 【CCPC】2020CCPC长春 F - Strange Memory | 树上启发式合并(dsu on a tree)、主席树
- iOS14新特性-WidgetKit开发与实践
- [paper reading notes] community oriented attributed network embedding
- 如何更好地理解中间件和洋葱模型
- [paper reading notes] large scale heterogeneous feature embedding
- 中小企业为什么要用CRM系统
- 计算机专业的学生要怎样做才能避免成为低级的码农?
- 安卓快速关机APP
猜你喜欢
Key layout of the Central Government: in the next five years, self-reliance and self-improvement of science and technology will be the priority, and these industries will be named
Swoole v4.5.7 版本发布,新增--enable-swoole-json编译选项
csdn bug10:待加
注册滴滴加不上车怎么办?要怎么处理?
I have a crossed translation tool in my hand!
LeetCode:数组(一)
[C#.NET 拾遗补漏]11:最基础的线程知识
Connection to XXX could not be established. Broker may not be available
奸商加价销售mate40,小米可望在高端手机市场夺取更多市场
专业之旅——GitHub 热点速览 Vol.45
随机推荐
高通骁龙875夺安卓处理器桂冠,但外挂5G基带成为它的弊病
One of the 10 Greatest formulas in the world is well known
刷题到底有什么用?你这么刷题还真没用
一不小心画了 24 张图剖析计网应用层协议!
[elixir! #0073] beam 内置的内存数据库 —— ETS
js数组常用技巧
CSDN bug4: to be added
csdn bug3:待加
mac终端Iterm2支持rz和sz的解决方案
《Python Cookbook 3rd》笔记(2.4):字符串匹配和搜索
CSDN bug11: to be added
大专学历的我工作六年了,还有机会进大厂吗?
Graph undirected graph
[论文阅读笔记] Network Embedding with Attribute Refinement
What's the difference between delete, truncate, and drop, and what to do if you delete data by mistake
【iOS】苹果登录Sign in with Apple
Swoole 如何使用 Xdebug 进行单步调试
Bartender2021实现安全远程标签打印,年终全新发布
Coding style: SSM environment in MVC mode, code hierarchical management
坚持追查7年,近10亿美元比特币终被美国政府没收充公