Using Cwrsync to implement a scheduled synchronous backup of server files under Windows (with error handling method) _ Server Other

Source: Internet
Author: User
Tags rsync
First to download the Cwrsync server and client software, download the following address:

Service side: Cwrsync Server (multiple server file Sync Service) V4.1.0 Free Edition

Client: Cwrsync (multi-server file synchronization Client) V4.1.0 Free Edition

But we are generally not the latest version, the old version can go to the s.jb51.net server file sync zone download

I then installed the server side (10.0.2.136) on the local machine, and then installed the client on another machine (10.0.2.137) under the same network segment. To test, I placed our product Dnt site files on the F disk on the local machine and prepared to use the ASPX and Config folders under the site folder as the folder for synchronizing files. Then, under the Rsyncd.config file on its server, enter the following:
Copy Code code as follows:

Use Chroot = False
Strict modes = False
Hosts allow = *
Log file = Rsyncd.log
PID file = Rsyncd.pid
Port = 52326
Max connections = 4

# Module Definitions
# Remember Cygwin naming conventions:c:\work becomes/cygwin/c/work
#
[T_aspx]
Path =/cygdrive/f/dnt_snap/aspx
Read Only = False
Transfer logging = yes
Lock file = Rsyncd.lock

[T_config]
Path =/cygdrive/f/dnt_snap/config
Read Only = False
Transfer logging = yes
Lock file = Rsyncd.lock

Note: In the above section, set the listening port to 52326.
In this way, we--> the management tool--> service in the Control Panel, locate the service and launch it, as shown in the following figure:


At this point we can create a folder called Sync on the F Disk of the client (10.0.2.137), and create two folders named "Config" and "aspx" below to correspond to the folders on the sync server.

Then, create a batch file named Dnt_rsync.bat with the following content:
Copy Code code as follows:

Rsync-av Rsync://10.0.2.136:52326/t_config/cygdrive/f/sync/config
Rsync-av rsync://10.0.2.136:52326/t_aspx/cygdrive/f/sync/aspx

and place it in the bin directory under the Cwrsync Client installation directory (my installation directory is as follows: C:\Program Files\cwrsync\bin), and then double-click to start it.
This will start synchronizing the files:

After that, we can go to the client F disk corresponding to the current view of the synchronization over the file, hehe.

Of course Cwrsync is the incremental and modified synchronization, if you modify the corresponding files on the server side, the synchronization will only synchronize the modified files or new files.

Here's how to create a timed task by using Task Scheduler in Windows to perform a timed synchronization.

First on the client's machine: Control Panel-> Task schedule-> Click "Add Task Schedule", click Next in the appropriate pop-up window, and then click the "Browse" button in the navigation window, and then select the batch file "Dnt_sync.bat" that you created earlier:

At this point the system will display the following window prompts the current scheduled task execution mode, I choose to do it every day (once):

Here, the system creates a task plan called Dnt_sync, and prompts the task's start time in the next window:

Here do not make any changes, directly click Next, and then authentication (usually the administrator), the task must be scheduled Pheton, have sufficient permissions to play the turn:)

When the final click completes, a task plan is created. But it was executed on a day's basis, what if we want to do it every minute, but it's very simple, just click on the newly created task plan with the mouse and select "Properties" in the pop-up menu, then click "Advanced Button" in the "schedule" in the pop-up window, as follows:

A child window called advanced plan options will pop up and be set as follows:

Here, the scheduled task synchronizes the previous two folders 24 hours a day, running every minute.

Recently the use of software more than the time to develop software, resulting in the development of the amount of code is not as much as before, hehe. But this kind of software still has the application scene, the estimate will use in the future, therefore writes this article to share with everybody simultaneously to "the backup" place.

Author: Daizhj, the generation of earthquake troops

Many of the details of the above are not taken into account, and many problems often arise in practical applications.

Cwrsync Sync FAQ:
Error One:
@ERROR: Auth failed on module xxxxx
Rsync:connection unexpectedly closed (bytes read so far)
Rsync Error:error in Rsync protocol The data Stream (code) at IO.C (150)
Resolution: This is because the password is set incorrectly, can not login successfully, check the RSYNC.PWD, whether the spectator suit matches. This is also the case with the server-side failure to start the rsync service.
Error Two:
Password file must not is other-accessible
Continuing without password file
Password:
Workaround: This is because the permissions of the rsyncd.secrets are incorrect, or the location is not an NTFS partition
Error Three:
@ERROR: Chroot failed
Rsync:connection unexpectedly closed (bytes read so far)
Rsync Error:error in Rsync protocol The data Stream (code) at IO.C (150)
Workaround: This is because the path path you set in rsync.conf does not exist and you want to create a new directory to open synchronization.
Error Four:
rsync:failed to connect to 192.168.0.10:no route to host (113)
Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C [receiver=2.6.9]
Solution: The other side did not boot, firewall block, through the network firewall blocked, it is possible. Shutting down the firewall is actually turning on the TCP UDP port (default 873).
Error Five: password problem
If the configuration with Secrets file=wtjb51.conf, then you need to create a wtjb51.conf file, with Notepad open, with the user name and password, to facilitate the client through the password
Rsyncd.conf

Copy Code code as follows:

Use Chroot = False
Strict modes = False
Hosts allow = *
Log file = Rsyncd.log
PID file = Rsyncd.pid

# Module Definitions
# Remember Cygwin naming conventions:c:\work becomes/cygwin/c/work
#
[WTJB51]
Path =/cygdrive/d/jb51net
Read Only = False
Transfer logging = yes
Auto USER=WTJB51
Secrets file=wtjb51.conf

Wtjb51.conf
Copy Code code as follows:

Wtjb51:www.jb51.net

Error Six: Prompt permission issue
The server side needs to write modify permissions to the directory Svcwrsync user
If there are other problems, you can contact us to help resolve. qq:461478385

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.