当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- One of the 10 Greatest formulas in the world is well known
- 2020-11-07
- Promote China manufacturing upgrade, 3D visualization of production line in automobile assembly workshop
- 区块链论文集【三十一】
- ASP.NET Core框架揭秘[博文汇总
- [论文阅读笔记] A Multilayered Informative Random Walk for Attributed Social Network Embedding
- Wu Enda's refining notes on machine learning 4: basis of neural network - Zhihu
- [operation tutorial] introduction and opening steps of easygbs subscription function of national standard gb28181 protocol security video platform
- GNU assembly language uses inline assembly to extend ASM
- [论文阅读笔记] Community-oriented attributed network embedding
猜你喜欢
OSChina 周二乱弹 —— 我养的绿植分别为土豆,生姜,蒜
史上最全异常检测算法概述
csdn bug11:待加
About CentOS start error: the solution of failed to start crash recovery kernel arming
CSDN bug9: to be added
奸商加价销售mate40,小米可望在高端手机市场夺取更多市场
如何更好地理解中间件和洋葱模型
[论文阅读笔记] Community-oriented attributed network embedding
[paper reading notes] a multilayered informational random walk for attributed social network embedding
csdn bug4:待加
随机推荐
小度“破圈”提速,IoT迎来新故事
Several solutions to the problem that selenium webdriver always fails to use click
[paper reading notes] network embedding with attribute refinement
csdn bug1:待加
Bartender2021实现安全远程标签打印,年终全新发布
layer.prompt(options, yes) - 输入层
csdn bug6:待加
The solution of polar experience insensitive verification
Hong Kong listed companies transfer cards to acquire 42.5% equity of chuangxinzhong and plan to speed up the distribution of marketing services
【LeetCode】 93 平衡二叉树
工厂方法模式
CSDN bug11: to be added
为什么要谨慎使用Arrays.asList、ArrayList的subList?
CSDN bug10: to be added
基于FPGA的MCP4725驱动程序
getIServiceManager() 源码分析
csdn bug8:待加
港股上市公司移卡收购创信众42.5%股权 谋划加快营销服务布局
[论文阅读笔记] Network Embedding with Attribute Refinement
What does the mremote variable in servicemanagerproxy refer to?