CentOS rsync Server for data synchronization with Windows Cwrsync clients

Source: Internet
Author: User
Tags custom name rsync



Description



1. Rsync Service Side



System: CentOS 5.5


Install centos web panel

IP Address: 192.168.21.160



Data storage directory:/data/xuersync



2. Centos web panel


System: Windows Server 2003


Install centos web panel on centos 7

IP Address: 192.168.21.130



Directories synchronized: D:\xuersync


Centos web panel tutorial

Purpose of implementation:

Virtualmin vs centos web panel 


Cwrsync client automatically synchronizes data from the Rsync server/data/xuersync directory to the D:\xuersync directory every 3:00 clock



One, rsync server configuration



1. Turn off SELinux



Vi/etc/selinux/config #编辑防火墙配置文件



#SELINUX =enforcing #注释掉



#SELINUXTYPE =targeted #注释掉



Selinux=disabled #增加



: Wq #保存, close



Shutdown-r now #重启系统






2. Open Firewall TCP 873 port (rsync default port)



Vi/etc/sysconfig/iptables #编辑防火墙配置文件



-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 873-j ACCEPT



: wq! #保存



/etc/init.d/iptables Restart #最后重启防火墙使配置生效



3. Install Rsync Server Software



Yum Install rsync xinetd #安装



Vi/etc/xinetd.d/rsync #编辑配置文件, set boot up rsync



Disable = no #修改为



/etc/init.d/xinetd start #启动 (xinetd to manage rsync services in CentOS)



4. Create a rsyncd.conf configuration file



Vi/etc/rsyncd.conf #创建配置文件, add the following code



Log file =/var/log/rsyncd.log #日志文件位置, automatically generate this file after Rsync is started, without having to create it in advance.



[Xuersync] #自定义名称



Path =/data/xuersync #Rsync服务端数据目录路径



Comment = Xuersync #模块名称与 [Xuersync] Custom name is the same



UID = root #设置rsync运行权限为root



GID = root #设置rsync运行权限为root



port=873 #默认端口



Read Only = no #设置为no, Cwrsync client can upload file, yes Read only



Write only = no #设置为no, cwrsync client can download file, yes cannot download



Auth users = Xuersyncbakuser #执行数据同步的用户名, can be set multiple, separated by commas in the English state



Secrets file =/etc/rsync.pass #用户认证配置文件, which stores the user name and password, which is created later



Hosts allow = 192.168.21.130 #允许进行数据同步的客户端IP地址, can be set multiple, separated by commas in the English state



Hosts deny = 192.168.21.254 #禁止数据同步的客户端IP地址, can be set multiple, separated by commas in the English state



List = yes #显示Rsync服务端资源列表






: wq! #保存



5. Create User authentication files



Vi/etc/rsync.pass #配置文件, add the following:



xuersyncbakuser:123456 #格式, user name: password, can be set multiple, one user name per line: password



: wq! #保存



6. Set file permissions



chmod 600/etc/rsyncd.conf #设置文件所有者读取, write permission



chmod 600/etc/rsync.pass #设置文件所有者读取, write permission



7. Start Rsync



/etc/init.d/xinetd Start #启动



Service xinetd Stop #停止



Service xinetd Restart #重新启动



Second, Cwrsync client settings



1. Download Cwrsync client Software



: Http://jaist.dl.sourceforge.net/project/sereds/cwRsync/4.0.3/cwRsync_4.0.3_Installer.zip



2. Install Cwrsync Client



Decompression Cwrsync_4.0.3_installer.zip Double hit Open cwrsync_4.0.3_installer.exe



Next step



Iagree agreed to install



Next



Default installation path C:\Program Files\cwrsync



Install installation



Close installation Complete, closing



3. Test whether the communication with Rsync server is successful



Start-run-cmd



Input CD C:\Program files\cwrsync\bin carriage return



Re-enter Telnet 192.168.21.160 873 return car



The Telnet interface indicates successful communication with Rsync server



Note C:\Program Files\cwrsync\bin refers to the Cwrsync program installation path



4. Cwrsync client synchronizes data from Rsync server



Start-run-cmd, enter CD C:\Program Files\cwrsync\bin return



Re-enter



rsync--PORT=873-VZRTOPG--progress--delete [email protected]::xuersync/cygdrive/d/xuersync



Enter Password: 123,456 return car



Start synchronizing data, wait for execution to finish, can open D:\xuersync compare with the data in the Rsync server/data/xuersync directory to see if it is the same



Description



D/xuersync Representative D:\xuersync



Xuersync represents the custom module name in the/etc/rsyncd.conf file comment = Xuersync



192.168.21.160 #Rsync服务端IP地址



Xuersyncbakuser #执行数据同步的用户



--port=873 #端口



-VZRTOPG--progress #显示同步过程详细信息



--delete #从cwRsync客户端D: The \xuersync directory removes data that is not identical to the Rsync server/data/xuersync directory, which guarantees that the data on both sides is exactly the same



Third, add the batch script file in the Cwrsync client's task plan, automatically synchronize the data in the Rsync server/data/xuersync directory to D:\xuersync directory every day 3:00 clock



1. Open C:\Program files\cwrsync\bin directory new Passwd.txt



Input 123456



Save



Continue to new Xuersync.bat in C:\Program files\cwrsync\bin directory



Input



@echo off



Echo.



Echo starts syncing data, wait a minute ...



Echo.



CD C:\Program Files\cwrsync\bin



RSYNC-VZRTOPG--port=873--progress--delete [email Protected]::xuersync/cygdrive/d/xuersync < Passwd.txt



Echo.



echo Data Sync complete



Echo.



Last Save exit



2. Add batch script to Windows Task Scheduler






Start-Settings-Control Panel-Task Scheduler



Open the Add task schedule, Next



Browse, select Open C:\Program files\cwrsync\bin directory inside the Xuersync.bat



Perform this task, select Daily, Next



Starting Time: 3:00



Run this task: daily, next



Enter the login password for the Windows system administrator, next



Complete



Extension NOTE: If you want to adjust the sync time, open the Xuersync in the task plan



Switch to the Schedule to option settings, and you can also turn on advanced to set the script to run once every few minutes Xuersync.bat



At this point, the CentOS rsync server is synchronized with the Windows Cwrsync Client for data synchronization






This article is from the "lake and Laughter" blog, please make sure to keep this source http://hashlinux.blog.51cto.com/9647696/1761344



CentOS rsync Server for data synchronization with Windows Cwrsync clients


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.