当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Farfetch、阿里巴巴集团和历峰集团结成全球合作伙伴关系,将加速奢侈品行业数字化进程
- Only options request is sent, no post solution is sent
- [leetcode] 93 balanced binary tree
- Bartender2021 realizes secure remote label printing, new year-end release
- CentOS7本地源yum配置
- GNU assembly basic mathematical equations multiplication
- 监控系统选型,这篇不可不读!
- 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
- 【技术教程】Visual Studio 2017自建WebRTC中peerconnection_client程序报LNK2019 无法解析的外部符号错误
- Problems and solutions in configuring FTP server with FileZilla server
猜你喜欢

Swoole 如何使用 Xdebug 进行单步调试

The unscrupulous merchants increase the price of mate40, and Xiaomi is expected to capture more market in the high-end mobile phone market

Mongodb index management of distributed document storage database

Call the open source video streaming media platform dawinffc

CCR炒币机器人:新冠肺炎加速了监管机构对CBDC的兴趣

SEO界,值得收藏的10条金玉良言有哪些?

吴恩达《Machine Learning》精炼笔记 4:神经网络基础 - 知乎

设计 API 时通过 POST 获取数据需要注意哪些问题

jmeter接口测试--带有token的解决方法

OSChina 周二乱弹 —— 我养的绿植分别为土豆,生姜,蒜
随机推荐
Oschina: my green plants are potatoes, ginger and garlic
竞争性编程的思考:那些神话和令人震惊的事实[图]
LeetCode:二叉树(四)
图-无向图
Overview of the most complete anomaly detection algorithm in history
[论文阅读笔记] A Multilayered Informative Random Walk for Attributed Social Network Embedding
微服务授权应该怎么做?
大专学历的我工作六年了,还有机会进大厂吗?
为什么要谨慎使用Arrays.asList、ArrayList的subList?
Filezilla server配置FTP服务器中的各种问题与解决方法
Call the open source video streaming media platform dawinffc
他把闲鱼APP长列表流畅度翻了倍
The unscrupulous merchants increase the price of mate40, and Xiaomi is expected to capture more market in the high-end mobile phone market
从零开始学习 YoMo 系列教程:开篇
我手撸了一个划线翻译工具!
Connection to XXX could not be established. Broker may not be available
[paper reading notes] network embedding with attribute refinement
B. protocal has 7000eth assets in one week!
OSChina 周二乱弹 —— 我养的绿植分别为土豆,生姜,蒜
【高级测试工程师】新鲜出炉的三套价值18K的自动化测试面试(网易、字节跳动、美团)