当前位置:网站首页>Rsync for file backup
Rsync for file backup
2022-06-24 08:40:00 【An unreliable programmer】
rsync
rsync yes linux Data image backup tool under the system . Use the fast incremental backup tool Remote Sync Remote synchronization is possible , Support local replication , Or with others SSH、rsync Host synchronization .
You can mirror the entire directory tree and file system .
It's easy to keep the permissions of the original file 、 Time 、 Hard and soft links and so on .
You can install without special permission .
Fast : The first synchronization rsync It copies everything , But the next time only the modified files are transferred .rsync In the process of data transmission, compression and decompression operations can be implemented , So you can use less bandwidth .
Security : have access to scp、ssh And so on to transfer files , Of course, it can also be done directly socket Connect .
Support anonymous transmission , In order to facilitate the website mirror image .
rsync install
- download (2018 year 9 month 25 Japan 13:52:23 The latest version is 3.1.3)
wget https://download.samba.org/pub/rsync/src/rsync-3.1.3.tar.gz - decompression
tar -xvf rsync-3.1.3.tar.gz - Enter the unzipped directory
- To configure
./configure --prefix=/usr/local/rsync/ - compile
make - install
make install
Configure server conf
vi /etc/rsyncd.conf
Modify the following content according to your own situation and then copy it
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
# This line is required by the /etc/init.d/rsyncd script
uid = root
gid = root
use chroot = false # Is it limited to this directory , The default is true, When there is a soft connection , Need to be changed to fasle, If true Limit it to the default directory of the module
read only = yes # Is it read-only , If it is no Words , The customer service end fails to push to the service end , It should be changed to yes
#limit access to private LANs
hosts allow= # Client address
hosts deny=*
max connections = 5
#This will give you a separate log file
log file = /mnt/log/rsync.log
#This will log every file transferred - up to 85,000+ per user, per sync
transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 900
ignore nonreadable = yes
dont compress = .gz .tgz .zip .z .Z .rpm .deb .bz2
[test]
path = /home/back
comment = files backup
list=no
ignore errors
auth users = root
secrets file = /usr/local/rsync/rsyncd.secrets
#exclude =
Configure the server user password file
vi rsyncd.secrets
Here, you only need to match the configuration file 【test】 In the module secrets file The corresponding configuration items are consistent
The format of the content is user name : password
for example root:root123
Permission to modify user password file
chmod 600 /usr/local/rsync/rsyncd.secrets
Start the server program , Run in daemons mode
Get into bin Catalog , perform ./rsync --daemon You can start
You can confirm the successful startup by checking the port number netstat -antp|grep 873
About how to restart the server daemon
direct kill Drop the process and restart it , It is so violent
The client performs synchronization test
rsync -vzrtlopg --progress [email protected] Server side IP:: Module name /path/ --password-file=/etc/rsyncd.passwd
Command parsing :
-v, --verbose Detailed mode output .
-z, --compress Compress the backup files during transmission .
-r, --recursive Deal with subdirectories in recursive mode .
-t, --times Keep file time information .
-l, --links Keep the soft links .
-o, --owner Keep file owner information .
-p, --perms Keep file permissions .
-g, --group Keep file group information .
Because what we do is redundant active and standby , So don't add --delete Delete those DST in SRC No documents .
If you need to do a full synchronization , You need to add --delete command , That is, the files deleted by the server , The client will also delete .
Scheduled backup
Add the above command to the scheduled task , You can achieve daily standby .
Step on the hole guide
1. Daemon mode must be started with --daemon Parameters
2. If the password of the client is also stored in the file , As shown above , Note that the client password file is different from the server password file , The client does not need a user name , Just a password .
边栏推荐
猜你喜欢

ZUCC_ Principles of compiling language and compilation_ Experiment 01 language analysis and introduction

ZUCC_编译语言原理与编译_实验06 07 语法分析 LL 分析

Maya re deployment

ZUCC_ Principles of compiling language and compilation_ Experiment 04 language and grammar

ZUCC_编译语言原理与编译_实验08 语法分析 LR 分析

【无标题】

OpenCV to realize the basic transformation of image

Introduction to RCNN, fast RCNN and fast RCNN

Longhorn installation and use

Base64编码详解及其变种(解决加号在URL变空格问题)
随机推荐
RuntimeError: Missing dependencies:XXX
Fundamentals of 3D mathematics [17] inverse square theorem
Question 4 - datepicker date selector, disabling two date selectors (start and end dates)
App Startup
js中通过key查找和更新对象中指定值的方法
[untitled]
Ordinary token
提高INSERT速度
Maya re deployment
Base64编码详解及其变种(解决加号在URL变空格问题)
Two methods of QT exporting PDF files
Final review and key points of software process and project management
独立站运营中如何提升客户留存率?客户细分很重要!
单目双视三维坐标确定
2021-03-11 comp9021 class 8 notes
ZUCC_编译语言原理与编译_实验02 FSharp OCaml语言
Small sample fault diagnosis - attention mechanism code - Implementation of bigru code parsing
IIS build wordpress5.7 manually
ZUCC_ Principles of compiling language and compilation_ Experiment 02 fsharp Ocaml language
leetcode 1268. Search Suggestions System(搜索推荐系统)