linux同步

A.2台虚拟机安装CentOS6.4,一台192.168.3.16,当做服务器,不需要安装lsync。一台192.168.50.171

B.CentOS默认已经安装了rsync,直接使用

C.192.168.3.16上面配置

1安装lsyncd-2.1.5.tar.gz


tar -zxvf lsyncd-2.1.5.tar.gz
cd lsyncd-2.1.5.tar.gz
./configure
make
make install

2.配置

cd etc

vi rsyncd.conf

trict modes = yes  需要密码验证

port = 873  端口号

log file = /var/log/rsyncd.log

pid file = /usr/local/rsync/rsyncd.pid

[test]----模块的名称,后面需要用的

max connections = 5

        uid = root

        gid = root

         path = /iso  同步路径

         ignore errors

         read only = no

         write only = no

         hosts allow = 192.168.50.171

         hosts deny = 10.5.3.77

         auth users = root

         secrets file = /home/rsync.ps  指定密码的位置


3.通过 which rsync查询安装的路径是/usr/bin/rsync,执行/usr/bin/rsync --daemon

[root@hf06 /]# which rsync

/usr/bin/rsync

[root@hf06 /]# /usr/bin/rsync --daemon

4.ps aux |grep rsync 查询进程

[root@hf06 /]# ps aux |grep rsync

root      7308  0.0  0.0 103248   812 pts/1    S+   16:22   0:00 grep rsync

5.netstat -an |grep 873 查询端口是否正常

[root@hf06 /]# netstat -an |grep 873

tcp        0      0 :::873                      :::*                        LISTEN

6。编写密码

vi /home/rsync.ps

root:zaq12wsx

7.cd home

chown root.root rsync.ps

chmod 600 rsync.ps

8.yum -y install xinetd

9.

[root@hf06 /]# /etc/init.d/xinetd restart

[root@hf06 /]# /etc/init.d/xinetd restart

停止 xinetd  [确定]

正在启动 xinetd  [确定]

10.vi /etc/rc.local

增加/usr/bin/rsync --daemon

11.vi etc/xinetd.d/rsync 改成

disable = no


D.192.168.50.171上面配置

1。安装rsync

2。执行

/usr/bin/rsync -vzr [email protected]::test /iso --password-file=/etc/rsync.ps

3。crontab -e  定期执行软件

4。每小时执行一次

* */1 * * * /usr/bin/rsync -vzr [email protected]::test /iso --password-file=/etc/rsync.ps




你可能感兴趣的:(linux,虚拟机,服务器,local,errors)