Batch update using cwRsync in Windows

Source: Internet
Author: User
Tags server installation and configuration

Some time ago I wrote an article on using rsync for batch update in Linux. I can see that there are still a lot of windows servers in online gaming companies. Today I will talk about the batch update method in windows, using cwRsync to synchronize data in windows

I. System Environment
Windows 2003 R2 sp2
Update source server: 10.8.5.240
Target Server: 10.8.5.2 10.8.5.3 ......

Server: cwRsyncServer_4.1.0_Installer
Client: cwRsync_4.1.0_Installer

Ii. Update the installation configuration of the source server (rsync server)
1、double-click cwrsyncserver_4.1.0_installer.exe and proceed to the next step. By default, the server that installs cwRsync has an administrator account SvcCWRSYNC, which can be modified on its own.

After the installation is complete, you can see the corresponding cwRsync service in the "service". After the installation is complete, you need to manually start the service.

2. Modify the rsyncd. conf configuration file (C: \ Program Files \ ICW \ rsyncd. conf)

  1. Use chroot = false # Do not use chroot
  2. Strict modes = false # static mode
  3. Hosts allow = * # All IP addresses are allowed
  4. Log file = rsyncd. log # log file name. You can specify the path
  5. Pid file = rsyncd. pid
  6. Port = 8173 # default port 873
  7. Uid = 0 # No uid is specified. No account can be used without this line.
  8. Gid = 0 # do not specify gid
  9. Max connections = 10 # max connections 10
  10. # Module definitions
  11. # Remember cygwin naming conventions: c: work becomes/cygwin/c/work
  12. [Web_1]
  13. Path =/cygdrive/d/www/web_1 # path to be backed up (d Drive www/web_1 directory)
  14. Read only = false # read-only
  15. Transfer logging = yes # record transfer logs
  16. Ignore errors # ignore unrelated IO errors
  17. List = no # non-column file table
  18. Hosts allow = 10.8.5.0/255.255.255.0 # IP addresses allowed for access
  19. Hosts deny = * # Do Not allow access from any IP address other than hosts allow
  20. [Web_2]
  21. Path =/cygdrive/d/www/web_2 # path to be backed up (d Drive www/web_2 directory)
  22. Read only = false # read-only
  23. Transfer logging = yes # record transfer logs
  24. Ignore errors # ignore unrelated IO errors
  25. List = no # non-column file table
  26. Hosts allow = 10.8.5.0/255.255.255.0 # IP addresses allowed for access
  27. Hosts deny = * # Do Not allow access from any IP address other than hosts allow

3. After the configuration file is modified, manually start the RsyncServer service, netstat-an. Check if port 8173 is listening.

Iii. Target Server installation and configuration (rsync client)
1、double-click cwrsync_4.1.0_installer.exe, and then perform the next step

2. Compile batch files for timed updates
10.8.5.2 (rsync. bat)

  1. @ Echo off
  2. C: \ "Program Files" \ cwRsync \ bin \ rsync.exe-avzP -- progress -- delete rsync: // 10.8.5.240: 8173/web_1/cygdrive/d/www/web_1> d: \ rsync _ % date :~ 0, 10%. log

10.8.5.3 (rsync. bat)

  1. @ Echo off
  2. C: \ "Program Files" \ cwRsync \ bin \ rsync.exe-avzP -- progress -- delete rsync: // 10.8.5.240: 8173/web_2/cygdrive/d/www/web_2> d: \ rsync _ % date :~ 0, 10%. log

Or add C: \ "Program Files" \ cwRsync \ bin \ to the user's environment variable. In this example, no absolute path is required before rsync.exe.

3. parameter description
-A parameter, equivalent to-rlptgoD,
-R is recursion
-L indicates a link file, which means copying a link file;
-P indicates that the original file permission is maintained;
-T preserve the original time of the file;
-G: Retain the original user group of the file;
-O maintain the original owner of the file;
-D is equivalent to a block device file;
-Z compression during transmission;
-P transmission progress;
-V verbose, detailed mode output;
-U is used to synchronize only updated files, so as to avoid repeated updates to non-updated files. However, pay attention to the synchronization between the two machine clocks;
-- Progress displays the backup process;
-- Delete: delete the files that are not in the SRC file in DST and used for file synchronization;

4. Set scheduled tasks
Synchronize every 5 minutes

5. Manually test synchronization Information

  1. C: \ "Program Files" \ cwRsync \ bin \ rsync.exe-avzP -- progress -- delete rsync: // 10.8.5.240: 8173/web_1/cygdrive/d/www/web_1

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.