Use reverse CT for rsync for server synchronous backup and rsync server configuration
Use reverse CT to remove the delivery process to Achieve Synchronous server backup
First, install keep CT
Check whether audit CT is installed
Rpm-qa | grep tcl
Tclx-8.4.0-5.fc6
Tcl-8.4.13-4.el5
Second, install keep CT
:
Http://dl.oschina.net/soft/expect
Check the installation location of tcl
Rpm-qa | grep tcl
Tcl-devel needs to be installed
Rpm-ivh tcl-devel-8.4.13-4.el5.x86_64.rpm
Decompress the unzip CT source code package
Tar xzvf expect-5.45-1374045102000.tar.gz
Cd expect5.45/
Compile: Find the path of/usr/lib64/tclConfig. sh.
./Configure -- with-tcl =/usr/lib64/
Make
Make install
Run CT
[Root @ localhost expect5.45] # verify CT
Failed CT: error while loading shared libraries: libexpect5.45.so: cannot open shared object file: No such file or directory
Find/-name libexpect5.45.so
Ln-sf/usr/lib/expect5.45/libexpect5.45.so/usr/lib64/libexpect5.45.so
Run Secondary CT again
Expect1.1> [root @ localhost/] #
Okay.
Encryption and decryption tools
Write the CT script:
#! /Usr/bin/CT-f ################################ ########################## 1. service ip #2. user #3. userPassword #4. localPath [local path] #5. serverPath [server path] # Return Value: #0 success #1 incorrect number of parameters ############################### ########################### proc usage {}{ regsub ". */"$: argv0" "name send_user" Usage: \ n "send_user" $ name serviceip User userPassword localPath serverPath \ n "exit 1 }## determine the number of parameters if {[ll Ength $ argv]! = 5} {usage} # set the variable value set severip [lindex $ argv 0] set User [lindex $ argv 1] set userPassword [lindex $ argv 2] set localPath [lindex $ argv 3] set serverPath [lindex $ argv 4] # define whether to enter yes when marking the rsync connection as a variable to confirm set inputYes 0 # rsync-avz/etc/192.168.15.234: /home/7_8spawn rsync-avz $ {localPath }$ {User }@$ {severip }: $ {serverPath} Your CT {-nocase-re "yes/no" {send -- "yes \ r" set inputYes 1}-nocase-re "assword: "{send --" $ {userPassword} \ r "interact}-nocase-re" Connection refused "{send_error" Sftp services at $ {ftpServerIp} is not active. \ n "exit 2} timeout {send_error" Connect to sftp server $ {ftpUser }@$ {ftpServerIp} timeout (10 s ). \ n "exit 8 }}# if yes is entered, enter the password if {$ inputYes = 1} {your CT {-nocase-re" assword: "{send --" $ {userPassword} \ r "interact }}}
Remote synchronize (Rsync) is a remote data synchronization tool that can be used to synchronize files between local and remote hosts.
The advantage of rsync is that only two different parts of the file are synchronized, and the same part is not transmitted. Similar to Incremental backup,
This saves a lot of time than the scp tool for transferring backup files or Synchronizing files on the server.
Specific usage:
1. Synchronize the two directories on the local machine
$ rsync -zvr filename1 filename2
The above code is to synchronize the files in filename1 with the files in filename2. If you synchronize the files in filename2 to filename1, modify the code:
$ rsync -zvr filename2 filename1
Parameter description:
-Z: Enable Compression
-V details output
-R indicates Recursion
2. Use rsync-a to synchronize the retention time by tag
$ rsync -azv filename1 filename2
Use the preceding command to synchronize the files in filename2 at the same time as the files created in filename1,
It retains symbolic links, permissions, time tags, user names, and group names.
3. Synchronize files locally to the remote server
$rsync -avz filename1 root@192.168.0.1:/home/redhat/filename2
The above command is to synchronize local filename1 to the host of remote 192.168.0.1.
Note: If the remote host port is not the default port 22 and port 3000, change the preceding command,
$ rsync -avz '-e ssh -p 4000' filename1 root@192.168.0.1:/home/redhat/filename2
4. Synchronize the files on the remote server to the local device.
Similar to step 3, you only need to change the location of filename1 and the remote server,
$rsync -avz root@192.168.0.1:/home/redhat/filename2 filename1
Similarly, if the port is not 22, run the following command:
$ rsync -avz '-e ssh -p 4000' root@192.168.0.1:/home/redhat/filename2 filename1
How to restore data backed up by rsync file system consider using DataKeeper or Rsync 2 software to achieve real-time file backup and permission backup to meet the requirements for FTP-based data synchronization with the client
If rsync is used for Incremental backup of linux hard disk files for file synchronization, how can I back up Incremental backup !! Please advise rsync-av '-e ssh-p 22'/data/backup root@192.168.100.1:/data