Our first two chapters have done the rsync sync effect, synchronized when we are synchronized through the Rsync tool, but imagine, in the production environment, we can not always use the Rsync tool for manual synchronization, how to solve this problem, how to achieve automatic real-time synchronization, Let's do the testing next.
The SSH backup source is backed up by scheduled tasks and scripts:
1. First write the backup script
650) this.width=650; "style=" Float:none; "title=" 1.png "src=" http://s3.51cto.com/wyfs02/M00/70/6F/ Wkiol1w4pvpixmwdaaa7hkzfhhm999.jpg "alt=" Wkiol1w4pvpixmwdaaa7hkzfhhm999.jpg "/>
650) this.width=650; "style=" Float:none; "title=" 2.png "src=" http://s3.51cto.com/wyfs02/M00/70/72/ Wkiom1w4pqwq0eytaacd6gpz6hq028.jpg "alt=" Wkiom1w4pqwq0eytaacd6gpz6hq028.jpg "/>
650) this.width=650; "style=" Float:none; "title=" 3.png "src=" http://s3.51cto.com/wyfs02/M00/70/72/ Wkiom1w4pqwy75bxaaa_x5o2afm962.jpg "alt=" Wkiom1w4pqwy75bxaaa_x5o2afm962.jpg "/>
2. The script is already written, but there is a problem, when we use the Rsync tool to upload or download the ssh source, he will prompt to enter the user's password, when we use the scheduled task to backup, it is impossible to stare at it in the password bar.
We now, using a technology, is the SSH key pair authentication method, as long as the connection once, will not be required to enter a password.
Modify the server-side SSH configuration file to enable key pair validation
650) this.width=650; "title=" 6.png "src=" Http://s3.51cto.com/wyfs02/M01/70/70/wKioL1W4RJjhR6tjAAA4W2Vo6zk053.jpg " alt= "Wkiol1w4rjjhr6tjaaa4w2vo6zk053.jpg"/>
650) this.width=650; "title=" 5.png "src=" Http://s3.51cto.com/wyfs02/M02/70/73/wKiom1W4QuPTj9ETAABIWSsDHGY656.jpg " alt= "Wkiom1w4quptj9etaabiwssdhgy656.jpg"/>
Generate a key pair on the client and upload the secret key to the server's user directory for Rsync synchronization (be sure to note that the password entered here must be complex, or it will be an error)
650) this.width=650; "title=" 4.png "src=" Http://s3.51cto.com/wyfs02/M02/70/73/wKiom1W4QyOiA2FOAAHgRW3m9vc358.jpg " alt= "Wkiom1w4qyoia2foaahgrw3m9vc358.jpg"/>
650) this.width=650; "title=" 7.png "src=" Http://s3.51cto.com/wyfs02/M01/70/70/wKioL1W4RU7SPB81AADOCsSdr-0846.jpg " alt= "Wkiol1w4ru7spb81aadocssdr-0846.jpg"/>
Connect to the server via SSH, record the password, and then use the script to automatically pass.
650) this.width=650; "title=" 8.png "src=" Http://s3.51cto.com/wyfs02/M01/70/70/wKioL1W4RcTRX_hPAABC6uwOOhY003.jpg " alt= "Wkiol1w4rctrx_hpaabc6uwoohy003.jpg"/>
Linux rsync Sync (cont.)