/allsystembackup#mkdir/home/allsystembackup/backup1#mkdir/home/allsystembackup/backup2
Finally, start rsync:
#/etc/init.d/rsync Start
Two, client settings:
First, install the Rsync software:
#apt-get Install rsync
To edit the password file that holds the client:
#vi/etc/rsync.pass, or it can be anot
/backup/backups
Note: This is not the usual way to do this, it will be better to set the script for completing all tasks, and then arrange the script, but it is concise for this article, we will use this form.
Incremental BackupBut if we have backup software on another server? We just want to synchronize data and keep
script? This involves adding a trust relationship, which is described in more detail later in this section.rsync [OPTION] ... [[email protected]] HOST:SRC DEST remote copy remote - local # Rsync-av 192.168.0.101:/data/123.txt/tmpRemote copy via SSH, if you want not to enter the password manually, then you need to use SSH key pair.SSH Password-free login:Production of certification documents1: Public Key rs
I just got in touch with the rsync synchronization Backup Server File software. I am looking for an rsync parameter description today. I will introduce these parameters to you. I hope they will help you.
Rsync Installation
The latest version of rsync is 3.0.9.
Wget http://rs
is 52 speedup is 0.18
5. implement automatic data synchronization and manually write a small script. [Root @ localhost ~] template defined on the server after the colon # Vim rsync. Sh #! /Bin/bash/usr/bin/rsync-avz -- password-file =/etc/rsyncd. Secrets benet@192.168.1.1: Benet/OPT add automated backup [root @ localh
timed tasks on the client (client 72)Mkdir/server/scripts//Create a directory to store scriptsCd/server/scripts//Enter the storage script directory1, Script (function: Package, push, add successful identity, delete after 7 days of compression package)VI bak.sh//Common packaging script, fill in the following content#!/bin/ship=$ (ifconfig eth0|sed-n ' 2p ' |awk-f
server B and create a. ssh directory.
[Root @ Server-A ~] # Sshjack@192.168.1.87
...
[Jack @ Server-B ~] $ Mkdir. ssh; chmod 0700. ssh
> Run the following command on machine A to remotely copy the public key to machine B:
[Root @ Server-A ~] # Scp. ssh/id-rsa.pubroot@192.168.1.87:/home/jack/. ssh/authorized_keys
In this way, no interactive ssh Login is complete. Note that the. ssh directory permission of server B is preferably 700. If you grant it excessive permissions, no interactive logon ma
/USR/LOCAL/BIN/RSYNC-VZRTOPG--delete--progress--password-file=/etc/server.pass $src [email protected] $host 3::$ Dst3echo "${files} was rsynced" >>/tmp/rsynclog 2>1DonePut this script in the background to run and add to the self-boot fileSh/root/rsync.sh echo "/root/rsync.sh " >>/etc/rc.localThe relevant parameters in the script are as follows--TIMEFMT the output
case a VPS problems, and then switch IP resolution directly does not affect the site and other matters. For example, I want to back up here:
/home/wwwroot/www.111cn.net/backup/
We need to make sure that catalog files are present, and here we need to be aware that the 2 "www.111cn.net" above is the same name, but not under a VPS.
C-Backup target VPS already installed
rsync Backup toolI. SCPSCP Backup tool is not available for incremental backups1. Installing SCP[email protected] ~]# Yum install-y openssh-clients2, Scp-r 192.168.21.98:/tmp/a/./a/Copy the A directory below/tmp/from the remote host to the current directory-R: Recursively copy3, [[email protected] cheng]# SCP 1.txt 192.168.21.98:/root/cheng/Copy the files in the
B.scp/home/rsync/.ssh/id.rsa.pub [Email protected]:/home/rsync/Server B:Establish the directory where SSH stores the "Public key":Mkdir/home/rsync/.sshchmod 700/home/rsync/.sshTransfer the public key, MV to/HOME/RSYNC/.SSH, on Server A. As the commandMv/home/
.
RSYNC-VZRTOPG--progress--delete--password-file=/etc/rsyncd.secretes root@118.244.216.177::logs/data/lnmp
Note: The above command means to sync the files under this path (/USR/LOCAL/LNMP) of the server to the client's path (/DATA/LNMP).
To reverse, synchronize the client's files to the server, as follows:RSYNC-VZRTOPG--progress--delete--password-file=/etc/rsyncd.secretes/data/lnmp root@118.244.216.177::logs
3.
, change the permissions of 600chmod 600/ETC/RSYNCD.SCRTD, start the service (if you have a firewall, allow port 873 to pass)Rsync--daemon--config=/etc/rsyncd.conf 2. Configure the ClientClient I compiled my own installation of the rsync-3.0.3.tar.gzA, Installation:TAR-ZXVF rsync-3.0.3.tar.gzCD rsync-3.0.3./configureMa
monitoring scripts#vi/srv/rsync.shRsync.sh contents are as follows:#!/bin/bashsrc=/srv/test/#监视改文件路径, folder content changes trigger server data synchronizationDes=backup #客服端配置的模块 (customer service side will introduce)Host= "192.168.10.6" #同步到的IP地址, if multiple spaces are separated. For example: host= "192.168.10.6 192.168.10.7"/usr/local/bin/inotifywait-mrq--timefmt '%d/%m/%y%h:%m '--format '%T%w%f '-e modify,delete,create,attrib $SRC | While read
protected] backup]# md5sum-c check.txtIsn't it intuitive to see OK5. Push back the compressed file to the Rsync backup server, push the complete data to the directory specified by the modulersync-avz/backup/[Email Protected]::backup--password-file=/etc/rsync.passwordView pu
Background:
0. server data is very important. If the disk is damaged, it will be troublesome. As a manager, it is necessary to synchronize and back up data in real time.
1. rsync is a good backup tool. The following uses Ubuntu as an example to describe its preparation.
2. If the ip address of my server A is 10.141.247.12, the ip address of my backup client B is
] ~]# chmod 600/etc/rsync.password[Email protected] ~]# Ll/etc/rsync.password-RW-------. 1 root root 5 22:02/etc/rsync.password[Email protected] ~]# Cat/etc/rsync.passwordRsync_backup:oldboy[Email protected] ~]# rsync--daemon[Email protected] ~]#[Email protected] ~]# vim/etc/rc.local#!/bin/sh # # This script is executed *after* all and the other init scripts.# You can put your own initialization stuff in he
#/home/wwwroot/111cn.net/for a site directory that needs to be backed up synchronously
C-Set rs.sh permissions
The code is as follows
Copy Code
chmod +x/root/rs.sh
Test backups and scheduled backups
The execution of SH rs.sh can be implemented by manual backup Now, execution requires us to enter the/root/pass password before we can execute
We cer
Rsync is a very powerful tool, and its commands have many feature options, and we'll analyze all of its options below. The command format for Rsync can be the following six: rsync [OPTION] ... SRC DEST rsync [OPTION] ... SRC [User@]host:dest rsync [OPTION] ... [user@] HOST:S
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.