Description、
Install centos web panel
1. Rsync Service End
System: CentOS 5.5
IP Address: 192.168.21.160
Data storage directory:/data/osyunwei
2, Cwrsync Client
Centos web panel
System: Windows Server 2003
IP Address: 192.168.21.130
Synchronized Directories: D:\osyunwei
To achieve the purpose:
Cwrsync client automatically synchronizes data from/data/osyunwei directory in rsync server to D:\osyunwei directory every day 3:00
Install centos web panel on centos 7
First, rsync service-side configuration
1. Close SELinux
Vi/etc/selinux/config #编辑防火墙配置文件
#SELINUX =enforcing #注释掉
#SELINUXTYPE =targeted #注释掉
Selinux=disabled #增加
: Wq #保存, close
Shutdown-r now #重启系统
Virtualmin vs centos web panel
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 #最后重启防火墙使配置生效
Centos web panel tutorial
3, install Rsync Server Software
Yum Install rsync xinetd #安装
Vi/etc/xinetd.d/rsync #编辑配置文件, set power-on start rsync
Disable = no #修改为
/etc/init.d/xinetd start #启动 (CentOS is xinetd to manage rsync services)
4. Create rsyncd.conf configuration file
Vi/etc/rsyncd.conf #创建配置文件, add the following code
Log file =/var/log/rsyncd.log #日志文件位置, which automatically generates this file when you start rsync, without having to create it in advance.
[Osyunwei] #自定义名称
Path =/data/osyunwei #Rsync服务端数据目录路径
Comment = Osyunwei #模块名称与 [Osyunwei] 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 files, yes can not download
Auth users = Osyunweibakuser #执行数据同步的用户名, you can set multiple, separated by commas in English state
Secrets file =/etc/rsync.pass #用户认证配置文件, which saves the user name and password, which is later created
Hosts allow = 192.168.21.130 #允许进行数据同步的客户端IP地址, you can set multiple, separated by commas in English state
Hosts deny = 192.168.21.254 #禁止数据同步的客户端IP地址, you can set multiple, separated by commas in English state
List = yes #显示Rsync服务端资源列表
: wq! #保存
5, the creation of user certification files
Vi/etc/rsync.pass #配置文件, add the following
osyunweibakuser:123456 #格式, Username: password, you can set multiple, one user name per line: password
: wq! #保存
6. Set file permissions
chmod 600/etc/rsyncd.conf #设置文件所有者读取, Write permissions
chmod 600/etc/rsync.pass #设置文件所有者读取, Write permissions
7. Start Rsync
/etc/init.d/xinetd Start #启动
Service xinetd Stop #停止
Service xinetd Restart #重新启动
Second, Cwrsync client settings
1, download Cwrsync client software
Download Address: http://s.jb51.net
2. Install Cwrsync Client
Decompression Cwrsync_4.0.3_installer.zip Double hit Open cwrsync_4.0.3_installer.exe
Next Next
Iagree agreed to install
Next
Default installation path C:\Program Files\cwrsync
Install Installation
Close installation Complete, closing
3. Test if 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 back to the car
A Telnet interface appears to demonstrate successful communication with Rsync server
Note C:\Program Files\cwrsync\bin refers to the Cwrsync program installation path
4, Cwrsync client synchronization rsync Server data
Start-run-cmd, enter CD C:\Program files\cwrsync\bin carriage return
And then enter
rsync--PORT=873-VZRTOPG--progress--delete Osyunweibakuser@192.168.21.160::osyunwei/cygdrive/d/osyunwei
Input password: 123,456 back to the car
Start synchronizing the data, wait for execution to complete, and open the D:\osyunwei to compare the data in the/data/osyunwei directory of the rsync server to see if it is the same
Description
D/osyunwei Representative D:\osyunwei
Osyunwei represents a custom module name in the/etc/rsyncd.conf file comment = Osyunwei
192.168.21.160 #Rsync服务端IP地址
Osyunweibakuser #执行数据同步的用户
--port=873 #端口
-VZRTOPG--progress #显示同步过程详细信息
--delete #从cwRsync客户端D: Delete data in the \osyunwei directory that is not the same as the/data/osyunwei directory in the rsync server, ensuring that the data on both sides is consistent
Third, add batch script files to the Cwrsync client's task schedule to automatically synchronize the data in the/data/osyunwei directory of the rsync server to the D:\osyunwei directory every day 3:00
1, open C:\Program files\cwrsync\bin directory new Passwd.txt
Enter 123456
Save
Continue to create a new osyunwei.bat in the C:\Program files\cwrsync\bin directory
Input
@echo off
Echo.
Echo begins synchronizing data, please wait ...
Echo.
CD C:\Program Files\cwrsync\bin
RSYNC-VZRTOPG--port=873--progress--delete Osyunweibakuser@192.168.21.160::osyunwei/cygdrive/d/osyunwei < Passwd.txt
Echo.
Echo Data Synchronization complete
Echo.
Last Saved exit
2, add batch script to Windows Task Scheduler
Start-Settings-Control Panel-Task Scheduler
Open Add Task Schedule, Next
Browse, choose to open the Osyunwei.bat in the C:\Program files\cwrsync\bin directory
Perform this task, choose Daily, Next
Starting Time: 3:00
Run this task: every day, next
Enter the login password for the Windows system administrator, and next
Complete
Extension Description: If you want to adjust the time of synchronization, open the Osyunwei in the task plan
Switch to schedule to option settings, and you can open advanced to set the script to run once every few minutes Osyunwei.bat
To this point, the CentOS rsync server implements data synchronization with the Windows Cwrsync client