Cwrsyncserver the implementation process of real-time synchronization of data from Windows to Linux servers

Source: Internet
Author: User
Tags rsync

Because the company has two Windows servers, development in the operation of the general is to upload some data on these two servers or modify something, and Linux server on the windows to be consistent with the data and do not need to implement this process, based on this process, yesterday took a little time, Completed the basic test implementation process, today to record this process, easy to view later, in order to hope to help the still confused friends.


First step: Install cwRsyncServer4.1.0 on Windows and configure the process:


Download the installation package on Windows Cwrsyncserver4.rar, this is not much resolution, we all understand, if you install Windowd server on the virtual machine, if your Windows server is not on the network, then the local computer downloaded good copy of the past, if you do not know how to copy to Windows If you go up there, build an FTP server on Linux and drop the files and share them.


If this problem occurs in the copy: Windows 2003 current security settings do not allow the solution to download files from this location:

You only need to set Internet options--security and custom levels to find "file download" in the download, enable.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/BE/wKioL1Pqvd2A_AxwAAL26uRPSDw894.jpg "title=" Qq20140812093216.png "alt=" Wkiol1pqvd2a_axwaal26urpsdw894.jpg "/>


The following is the Cwrsyncserver installation process, always point to the next step, here will not be posted out:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/45/BD/wKiom1PqvTCwF3n_AAIPAM5UBbU968.jpg "title=" Qq20140812093600.png "alt=" Wkiom1pqvtcwf3n_aaipam5ubbu968.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/BE/wKioL1PqvlmykeF8AAGxmWS1va8472.jpg "title=" Qq20140812093742.png "alt=" Wkiol1pqvlmykef8aagxmws1va8472.jpg "/>

You need to create an account here, just use the default is good, set a password on your own OK.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/BD/wKiom1PqvXfhq9fdAADLPZzCyjw670.jpg "title=" Qq20140812093818.png "alt=" Wkiom1pqvxfhq9fdaadlpzzcyjw670.jpg "/>


After the installation is complete, start the configuration below, open the file directory under the installation directory: C:\Program files (x86) \ICW, modify the contents of the rsyncd.conf configuration file for the following configuration;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/BE/wKioL1PqvxaScZyhAAHXxLdhct8777.jpg "title=" Qq20140813092134.png "alt=" Wkiol1pqvxasczyhaahxxldhct8777.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/45/BE/wKioL1Pqv0yA_Uw4AAH-u_s2gm8933.jpg "title=" Qq20140812172219.png "alt=" Wkiol1pqv0ya_uw4aah-u_s2gm8933.jpg "/>

It should be noted here that if you do not write uid=0, and gid=0, the following conditions will occur on the remote connection: 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M02/45/BE/ Wkiol1pqv7lyow2naacvcgmivwc876.jpg "title=" Qq20140812172104.png "alt=" Wkiol1pqv7lyow2naacvcgmivwc876.jpg "/>


Here we go. Create a new Rsyncdata directory under the F-disk, which means that all data in it is synchronized to the specified directory of Linux, which is the corresponding file of the [Rsyncdata] module under Windows for the rsyncd.conf configuration file. We also need to change the configuration after the new build:

[Rsyncdata] #指定模块的头信息 path =/cygdrive/f/rsyncdata #需要同步数据的目录, this directory refers to the Rsyncdata directory under the f disk Read Only = True #是否为只读 List = no hosts allow = 10.17.1.200,10.17.1.88,10.17.1.60 #允许访问的主机, multiple comma-delimited auth users = rsync #指定认证的用户名 sec RETs file =/cygdrive/f/rsyncd.secrets #指定认证用户的密码文件存放路径, this path refers to the rsyncd.secrets under the F-disk, which you will need to create a new file

Also need to modify some of the Rsyncdata this directory related property information, right-click this file select Properties:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/BF/wKioL1PqxqaiX5DAAABhprn36qE304.jpg "title=" Qq20140813095327.png "alt=" Wkiol1pqxqaix5daaabhprn36qe304.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/45/BD/wKiom1PqwMPQ48L5AAJD8ELmMG8259.jpg "title=" Qq20140812130525.png "alt=" Wkiom1pqwmpq48l5aajd8elmmg8259.jpg "/>

After entering Svccwrsync This user name, click "Check name" can be matched, and then click OK OK.

Finally, change the access rights of this file to this user:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/45/BD/wKiom1PqwVuTjqouAAFriyIPZeg182.jpg "title=" Qq20140812130622.png "alt=" Wkiom1pqwvutjqouaafriyipzeg182.jpg "/>


Select My Computer-right-manage---services and apps-services, find Rsyncsever, double-click-Start, turn this server up:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/BD/wKiom1PqwfLyXaQDAAL-w8Zjkc8763.jpg "title=" Qq20140813093823.png "alt=" Wkiom1pqwflyxaqdaal-w8zjkc8763.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/BF/wKioL1PqwxyS3dIhAAGuT0La75s505.jpg "title=" Qq20140812130212.png "alt=" Wkiol1pqwxys3dihaagut0la75s505.jpg "/>

Here should be said that the configuration is finished under Windows, but note that if your Linux needs to use Telnet to connect to Windows, the firewall on Windows will remember to shut down, or it may not even go up, you can test on this, The following conditions indicate that you can connect to it, stating that the Windows service is available.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/45/BD/wKiom1PqwwqjwL5UAAGHxtWrLj0021.jpg "title=" Qq20140813094309.png "alt=" Wkiom1pqwwqjwl5uaaghxtwrlj0021.jpg "/>



Under cmd Enter your Windows native address and Rsync's listening port, its default listening port is 873, enter:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/BE/wKiom1Pqw6mz5CecAABvqKczt0k209.jpg "title=" Qq20140813094525.png "alt=" wkiom1pqw6mz5cecaabvqkczt0k209.jpg "/>650" this.width=650; "src=" http://s3.51cto.com /wyfs02/m02/45/bf/wkiol1pqxowczucpaaafxssasle514.jpg "title=" Qq20140813094625.png "alt=" Wkiol1pqxowczucpaaafxssasle514.jpg "/>

The appearance of @rsyncd:30.0 this means that it can be connected.


Two, rsync client configuration, this needs to be configured on Linux, the related configuration see the following process:


1. Check the selinux mechanism to turn off SELinux

[Email protected] ~]# Getenforce

Disabled

2. Installing the Rsync client software

[email protected] ~]# Yum install rsync xinetd

3, need to install the two software packages can be, after the installation of a bit to modify a little configuration file:

[[email protected] ~]# Vi/etc/xinetd.d/rsync #编辑配置文件, set boot up rsync, rsync on CentOS using xinetd enabled

Change the Disable=yes to No

Service rsync

{

Disable = no

Socket_type = Stream

wait = no

user = root

Server =/usr/bin/rsync

Server_args =--daemon

Log_on_failure + = USERID

}

/etc/init.d/xinetd Start #启动xinetd这个服务

4, after the modification of the remote connection test, remember to shut down the Windows Firewall, oh, otherwise it will probably not connect, or all on the Windows Firewall open 873 this port

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/BE/wKiom1PqxqfwxhnUAABZ0Zz9Akk082.jpg "title=" Qq20140813095836.png "alt=" Wkiom1pqxqfwxhnuaabz0zz9akk082.jpg "/>

OK, that means connecting to Windows is successful, then we'll create a directory that synchronizes with Windows:

[Email protected] ~]# mkdir pv/rsyncdata/data


In order to synchronize data without the need to manually enter the password each time, we also create a client (Linux) as a server-side (Windows)-like password file (this file path and password to be the same as the servers, the client does not write the name)

[Email protected] ~]# vim/etc/rsyncd.secrets #只需要写上服务器端上的用户密码就可以了

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/BE/wKiom1PqyBjBI3D8AAA O_o 7zhq8437.jpg " Title= "Qq20140813100358.png" alt= "wkiom1pqybjbi3d8aaa O_o 7zhq8437.jpg"/>

[Email protected] ~]# chmod 600/etc/rsyncd.secrets #改一下权限

5. Here we can write commands to pull the data on the Windows Server side:

[ email protected] ~]# RSYNC-VAZRTOPQG--delete--password-file=/etc/rsyncd.secrets [email protected]:: rsyncdata/*/rsyncdata/data/

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/BE/wKiom1PqyODh9NdHAAEGsrXk-Fc256.jpg "title=" Qq20140812171955.png "alt=" Wkiom1pqyodh9ndhaaegsrxk-fc256.jpg "/>

Transmission is successful, here is a description of what these parameters represent:

-V,--verbose #详细模式输出

-Q,--quiet #精简输出模式

-A,--archive #归档模式, means to transfer the file recursively and keep all file attributes equal to-rlptgod

-R,--recursive #对子目录以递归模式处理

-O,--owner #保持文件属主信息

-G,--group #保持文件属组信息

-T,--times #保持文件时间信息

--delete#删除那些DST中SRC没有的文件

--password-file=file#从FILE中得到密码

6, in order to have a data modification every time to manually to synchronize a step, we put this command into a script, and then add a task plan, this can be achieved automatically synchronize data;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/C0/wKioL1Pqy4awIx0nAABfDvqmtkY675.jpg "title=" Qq20140813101439.png "alt=" Wkiol1pqy4awix0naabfdvqmtky675.jpg "/>

[Email protected] ~]# CRONTAB-E

* * * * * */bin/bash/root/rsync.sh &>/dev/null #我们设置每分钟同步一次


OK, to here our entire configuration is completed, may also do not get the place, I hope friends found out to me, oh, first thanked.

This article is from the "boiled frog with boiling water" blog, please make sure to keep this source http://tanxw.blog.51cto.com/4309543/1539252

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.