Chapter III rsync enables data backup via remote SSH
Remote shell access for data synchronous backup
Pull-synchronizes data on the remote server to the local server.
Push-synchronizes data on the local server to the remote server.
Syntax format :
Pull Operation = = " rsync option User name @ backup source server IP address: Backup source directory destination directory
push Operation = = " rsync option Backup source directory user name @ destination server IP Address: Destination directory
Environment:
The local server is: DataServer, IP address: 192.168.88.8
The remote server is: Backupserver, IP address: 192.168.88.10
First section Interactive backup
Pull operation = = "
1. Back up the files and directories in the/appbackup directory on the remote server backupserver to the local server DataServer.
View remote server Backup source directory information [Email protected] ~]# ll/appbackup/ 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/75/wKioL1YeJNCi-FnbAADcjZ7tH7o553.jpg "title=" 1.png " Width= "615" height= "98" border= "0" hspace= "0" vspace= "0" style= "width:615px;height:98px;" alt= " Wkiol1yejnci-fnbaadcjz7th7o553.jpg "/> rsync to synchronize data on the remote server to the local server [[Email protected]~]# rsync-avzp [email protected]:/appbackup//app/ 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/78/wKiom1YeJQqACW12AAH108wuN4k299.jpg "title=" 2.png " Width= "615" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:615px;height:264px; "alt=" Wkiom1yejqqacw12aah108wun4k299.jpg "/> View local server destination directory information [Email protected] ~]# ll/app/ 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/78/wKiom1YeJUriM9w9AADbeuXLr0w503.jpg "title=" 3.png " Width= "615" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:615px;height:100px; "alt=" Wkiom1yejurim9w9aadbeuxlr0w503.jpg "/>
|
Push operation = = "
2. Back up the files and directories in the/data directory on the local server dataserver to the remote server backupserver.
View local server Backup source directory information [Email protected] ~]# ll/data/ 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/78/wKiom1YeJifB30NzAAD5bbT1fSE224.jpg "title=" 4.png " Width= "615" height= "126" border= "0" hspace= "0" vspace= "0" style= "width:615px;height:126px;" alt= " Wkiom1yejifb30nzaad5bbt1fse224.jpg "/> rsync enables synchronizing data on the local server to a remote server [Email protected] ~]# rsync-avzp/data/[email protected]:/backup/ 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/75/wKioL1YeJmDCq_-hAAEMaFJz32E947.jpg "title=" 5.png " Width= "615" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:615px;height:230px; "alt=" wkiol1yejmdcq_- Haaemafjz32e947.jpg "/> View remote server Backup destination directory information [Email protected] ~]# ll/backup/ 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/78/wKiom1YeJlTDwbCSAAEOtTYri6o403.jpg "title=" 6.png " Width= "615" height= "133" border= "0" hspace= "0" vspace= "0" style= "width:615px;height:133px;" alt= " Wkiom1yejltdwbcsaaeottyri6o403.jpg "/>
|
Second section no interactive backup
1. Create SSH key
[[email protected] ~]# ssh-keygen 650) this.width=650, "src=" http://s3.51cto.com/wyfs02/M01/74/75/wKioL1YeJ4-Ca6IiAAHdQo3HF2Y644.jpg "title=" 7.png " Width= "615" height= "387" border= "0" hspace= "0" vspace= "0" style= "WIDTH:615PX;HEIGHT:387PX;" alt= " Wkiol1yej4-ca6iiaahdqo3hf2y644.jpg "/> |
2. Copy SSH key
[email protected] ~]# Ssh-copy-id[email protected] 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/78/wKiom1YeJ8_S_DDhAAFgG6EK0Rw058.jpg "title=" 8.png " Width= "615" height= "198" border= "0" hspace= "0" vspace= "0" style= "width:615px;height:198px;" alt= "Wkiom1yej8_s_ Ddhaafgg6ek0rw058.jpg "/> |
3, test do not need to enter a password to log in
[[email protected] ~]# ssh [email protected] 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/75/wKioL1YeKZCyjUCbAACsKyQOUVo429.jpg "title=" 9.png " Width= "615" height= "107" border= "0" hspace= "0" vspace= "0" style= "WIDTH:615PX;HEIGHT:107PX;" alt= " Wkiol1yekzcyjucbaacskyqouvo429.jpg "/> |
4, the test does not need to enter a password to backup
[email protected] ~]# rsync-avzp[email protected]:/data//backup/ 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/75/wKioL1YeKbqgst8dAAEtJkX9j-0544.jpg "title=" 10.png "Width=" 615 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:615px;height:220px; "alt=" Wkiol1yekbqgst8daaetjkx9j-0544.jpg "/> |
Chapter III rsync enables data backup via remote SSH