Rsync_serverrsync Server Download
Download rsync_client rsync Client
Will be appliedRsyncIt is mainly because of the needs of the company's projects, the key isSqlserverA database backed up regularly to another backup server. Some other operation logs, such as uploaded files, need to be regularly backed up to the backup server. This solution actually involves some other operations. You can also talk about it in this blog post. One is the database's scheduled job, and the other isWindowsSchedule a task. Let's take a step by step.
SQL Server MS Maintenance Plan
Maintenance Plan (in the management items of object Resource Manager) is mainly usedSqlserverRegularly execute some tasks. These tasks mainly include:
ØCheck Data Integrity
ØPerform index Maintenance
ØUpdate database statistics
ØRegular Database Backup
One of the most important items in the maintenance plan is the plan preparation, that is, the Plan operation frequency and the specific time point. Create a maintenance plan. After skipping the Wizard Page, the page shown in is displayed.
Click Change in to modify the attributes of the job plan, as shown in.
After the job plan is prepared, the maintenance task is selected. As shown in
Next, select the database to be backed up and the storage path of the backup file. As shown in.
At the bottom of the scroll bar, you can choose whether to compress the backup. If the disk space is tight, we recommend that you select compress backup. In addition, different backup schemes are selected for the importance of data, including full backup and differential backup, which are performed every day or every week.
After the maintenance plan is developed based on the above method, a new maintenance plan will appear in the maintenance plan list. You can directly execute the plan to test whether the database can be successfully backed up. You can also modify the maintenance plan and change the time to a time point similar to the current time to test whether the job is executed automatically and periodically.
Rsync Introduction
RsyncIt is a powerful incremental transmission tool that can be used for backup of different directories on the same machine, or for transmission and backup between different machines. Easy to install and configure. It is a cross-platform toolLinux and WindowsCan be applied on the platform.
Rsync Configuration Server Installation
ØInstallCwrsyncserver_4.1.0_installer.zipServer Software
ØA newSvccwrsyncOfWindowsLog on to the account. You can change the password or the default value.(Unknown Default Value)
ØThe installation process can always be "Next". You do not need to modify the intermediate process. You can use the default value to complete the installation.
ØAfter installation, the service is started manually by default./In service management, startRsyncserver"Service, and modify"Rsyncserver"Is the automatic start mode.
ØNewPathThe environment variable namedPath, The variable value isRsyncUnder the Server Installation DirectoryBinDirectory path
Password File
ØInRsyncCreate a directory namedTxtFile, suchTest.txt. Content isUsername: Password (User name and password)
ØThenTxtMore extended namesSecrets
ØModify the permissions of the password file. RunCMDInputChmod 600/test. Secrets
ØIf no prompt is displayed in the previous step, the setting is successful.
Configuration File
ØThe configuration file is in the root directory of the Software InstallationRsyncd. confFile, open it with notepad
ØConfiguration endConfigFile,Configuration FileCodeAs follows:
Uid = 0#RunRsyncDaemon user0Not Limited
Gid = 0#RunRsyncDaemon Group0Not Limited
Use chroot = false
Strict modes = false
Hosts allow = *#Allowed hosts,*Indicates no restriction. The value here can be singleIPOr a CIDR block.
Log File = rsyncd. log # rsyncThe running log file, which indicates thatRsyncd. LogFile
# Module Definitions
# Remember cygwin naming conventions: C: \ work becomes/cygwin/C/work
#
[Weblog]#Define a node, or an entry
Path =/cygdrive/C/weblog //Path of the uploaded file(I do not understandLinuxSo this expression...-_-!!)
Read Only = false //Whether to allow upload. If it isTrueIndicates that any upload request will fail. The default value isTrue
Transfer logging = Yes
Allow Users = test #Permitted users,The user enteredUsername.
Secrets file = test. Secrets #Password File
Hosts allow = *#Allowed hosts
Hosts deny = *#Prohibited hosts
List file = true
[Database]
Path =/cygdrive/C/databackup
Read Only = false
Transfer logging = Yes
Allow Users = test
Secrets file = est. Secrets
Hosts allow = *
Hosts deny = *
List file = true
Note: The file directory for storing data needs to be addedSvrsyncThe user's full control permissions (this is found on the Internet, the author does not seem to have been added after the experimentSvrsync).
ØServer installation and configuration are complete.
Client installation
ØInstallCwrsync_4.1.0_installer.zipClient Software
ØNewPathEnvironment variable (you can also not modify the environment variable, add the environment variable to facilitate manual operationCMD)
Password File
ØThe password file must be exactly the same as that on the server.(It is also used on the Internet to say that the client's password file content can only have a password, and no other password is required. The author's test shows that the content on the server is completely consistent with that on the server.)
ØModify Password File PermissionsChmod 600/test. SecretsThe permission value can only be600
Synchronization command
ØIfPathEnvironment variable, directly inputRsyncWithout parameters,ProgramAll parameters are listed for reference.
ØIf notPathFor environment variables, useCDCommandRsyncUnder the installation directoryBinDirectory path
ØUpload:Rsync-avz/cygdrive/e/log-password-file = test. Secrets username @ IP Address: Weblog
ØThe above command sets the localEDiskLogAll contents of the folder includeLogFolder itself, uploaded@AfterIP addressAnd then defineWeblogThePathPath
ØYou can also add several common parameters.-Remove-source-FilesDelete the source file after synchronization.
Ø-- ProgressShow synchronization progress
Ø-- DeleteMake the directory consistent with that on the server
ØNext, let's talk about it in the previous introduction.RsyncIt is incremental transmission. Here, incremental transmission is overwrite.
ØDownload: the download command is very simple. Put the preceding path to the end.
ØRsync-avz -- password-file = test. Secrets test @ IP Address: weblog/cygdrive/e/log
ØThe above command definesWeblogUnder the nodePathDownload the file to the localEDiskLogDirectory
The above steps,RsyncThe client is also installed and set up to runCMD, Enter the command to test whether the file can be synchronized. The following describes how to useWindowsSchedule Tasks to implement automatic, scheduled, and synchronous file transfer.
Windows Scheduled tasks
NewWindowsScheduled tasks(Set on the client)
ØCreate a task(Non-basic task),A dialog box is displayed.
ØEnter a name, for example:Weblogbackup,Description, as shown in figure:Backup of operation logs on the Intellectual Property Platform
ØTabSwitch tag to "Trigger",Click create. The trigger indicates the conditions under which the created task starts to run. For example15:13:58Execute the task at this time.
ØTabSwitch the tag to the operation to set the operations to be performed by the task. Click create, as shown in.
The operation is run Rsync.exe Program, so it is the "Startup Program", the path is Rsync Under the installation directory Bin Directory Rsync.exe . In the parameter field, enter: -Avz/cygdrive/e/weblog -- password-file = test. Secrets test @ IP Address: Weblog . /Crgdrive/e/WeblogYes E Disk Weblog Contents in the folder are synchronized IP address ( For example 192.168.1.524) Machine. -- Password-file = test. Secrets It is a password file that has been set in advance. Test @ The username set in the password file is Test (The format of the password file is Username: Password ). : Weblog Yes. Rsync In the server configuration file [Weblog] Node configuration.
ØClick OKWindowsConfigure the scheduled task.
Conclusion: The above is a synchronization, automatic, and timed backup file solution adopted by the company's projects recently. This articleArticleSaidSQL Server MSScheduled maintenance plan,RsyncAndWindowsSchedule a task. Each part is not very detailed, and there have been no in-depth research in many places. However, this entire backup solution is feasible.
So here we will record it and share it with your colleagues. You guys will certainly have all kinds of opinions, opinions, and suggestions, hoping to come up with them and make common progress!