CentOS 6.3 rsync client and Win2003 cwrsyncserver Server implement data synchronization _ servers other

Source: Internet
Author: User
Tags chmod iptables rsync

Description

1. Cwrsyncserver Service End

System: Windows Server 2003

IP Address: 192.168.21.134

Data storage directory: D:\osyunwei

2, rsync Client

System: CentOS 6.3

IP Address: 192.168.21.132

Synchronized Directories:/osyunwei

To achieve the purpose:

The rsync client automatically synchronizes the number of Cwrsyncserver server D:\osyunwei directories to the/osyunwei directory every 3:00

First, Cwrsyncserver service-side configuration

Attachment:

Cwrsyncserver Download Address:

Http://www.jb51.net/softs/55933.html

Unzip Cwrsyncserver_4.0.3_installer.zip, double-click Cwrsyncserver_4.0.3_installer.exe

Next

I Agre (Agree)

Installation path, by default

Next

Service Account:svccwrsync (a new system account)

Type Password: password

Confirm Password: password

Note: The system will automatically create an account: Svccwrsync to run the Cwrsyncserver server program

The above information by default can be

Install (Installation)

Close (off), installation complete

Start-Settings-control Panel-management tools-services

Find the Rsyncsever option, double-click to open

Startup type: Automatic

Point "Start"

Application-Determine

Open D disk, right-click the Osyunwei folder, select Properties, switch to Security options, click Add

Input: Svccwrsync

Are you sure

Allow all permissions

Application, determine

Open C:\Program FILES\ICW Directory

Open rsyncd.conf with Notepad, modify add the following (back up the file as Rsyncd.confbak before modifying)

Use Chroot = False

Strict modes = False

Hosts allow = *

Log file = Rsyncd.log

# Module Definitions

# Remember Cygwin naming conventions:c:\work becomes/cygwin/c/work

#

#[test]

#path =/cygdrive/c/work

#read only = False

#transfer logging = yes

[Osyunwei]

Path =/cygdrive/d/osyunwei

Read Only = True #客户端只读

List = no #不允许列出文件

Hosts allow=192.168.21.132 #允许连接IP, multiple IP intermediate in English state comma-separated, do not limit IP fill * can

Auth users =osyunwei #允许连接的用户名

Secrets file = Etc/rsyncd.secrets #存放用户名密码的认证文件路径

After the repair is complete, save the exit

Create a new Rsyncd.secrets file under the C:\Program files\icw\etc directory

Open with Notepad and enter the following

osyunwei:123456 #用户名: Password

Last Saved exit

Cwrsyncserver Server-side installation setup Complete

Second, rsync client configuration

1. Close SELinux

Vi/etc/selinux/config

#SELINUX =enforcing #注释掉

#SELINUXTYPE =targeted #注释掉

selinux=disabled #增加

: Wq #保存, Exit

Shutdown-r now #重启系统

2, open firewall TCP 873 port (rsync default port, rsync as the client is not required to open the firewall port, here open, easy to expand later as a server)

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

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

: wq! #保存, Exit

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

3. Install rsync client Software

Yum Install rsync xinetd #安装, as shown in the following illustration, enter Y installation

Vi/etc/xinetd.d/rsync #编辑配置文件, set power-on start rsync

Change the Disable = Yes revision to

Disable = no

: wq! #保存, Exit

/etc/init.d/xinetd start #启动 (CentOS, rsync is managed xinetd)

4. Test if the Rsync client communicates successfully with the Cwrsyncserver server (cwrsyncserver Server firewall needs to open TCP 873 port)

Yum install telnet #安装telnet测试工具

Telnet 192.168.21.134 873 #输入命令后回车, as shown in the following illustration, to indicate a successful communication

Rsync Client Installation Settings complete

third, set the Rsync client and Cwrsyncserver server to synchronize data ( The following operations are performed on the rsync client)

1, test data synchronization

Entering at the terminal command line

RSYNC-VZRTOPG--port=873--progress--delete [email protected]:: Osyunwei /osyunwei

Tip Enter Password: 123456

Note: The password here is the password configured for the Cwrsyncserver server C:\Program files\icw\etc\rsyncd.secrets file

After the carriage return, the figure below shows that data synchronization is successful

Cd/osyunwei #进入数据同步目录

LS #显示文件信息

You can see that the data already exists.

2. Add scheduled Tasks, automatically execute data synchronization scripts every day

Vi/etc/passwd.txt #配置文件, add the following

123456 #密码

: wq! #保存退出

chmod 600/etc/passwd.txt #设置文件权限, only set the file owner to have read, write permission

Cd/home

VI osyunweibak.sh #编辑, add the following

#!/bin/sh

RSYNC-VZRTOPG--port=873--progress--delete [email Protected]::osyunwei/osyunwei--password-file=/etc/passwd.txt

: wq! #保存, Exit

chmod +x/home/osyunweibak.sh #添加脚本直接权限

Yum Install Vixie-cron #安装计划任务, some systems may not have pre-installed

vi/etc/crontab #编辑, add the following at the end

0 3 * * * root/home/osyunweibak.sh means backups are performed 3 o'clock in the morning daily  

: wq! #保存, exit

chkconfig Crond on #设为开机启动

service Crond start #启动

/etc/rc.d/init.d/crond Restart #重启

After the setup is complete,

Every 3 o'clock in the morning, the Rsync client automatically synchronizes Cwrsyncserver server-side D:\osyunwei directory data into its own/osyunwei directory

at this point, the CentOS 6.3 rsync client implements data synchronization settings with the Windows Server 2003 cwrsyncserver service End

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.