linux

Linux_296_Sersync配置文件部署

2022-11-02  本文已影响0人  为宇绸缪

1、确保rsync服务端正常
在客户端机器上 nfs_linux
rsync -avzP --delete /nfs_file/ rsync_backup@192.168.178.122::backup --password-file=/etc/rsync.password

2、确保当前客户端机器,是否支持inotify机制
[root@nfs_machine data]# ls /proc/sys/fs/inotify/
max_queued_events max_user_instances max_user_watches

sersync安装
1、获取代码包
sersync_installdir_64bit.zip
目录:/opt/sersync
unzip sersync_installdir_64bit.zip

进入sersync可执行命令目录,对命令进行授权执行
进入bin目录 chmod +x /opt/sersync/sersync_installdir_64bit/sersync/bin/sersync

sersync配置文件讲解

/opt/sersync/sersync_installdir_64bit/sersync/conf/confxml.xml

修改配置文件部分配置
指定部分文件不同步,排除某些文件
/data01 

查看文件的6-11行
<filter start="false">
        <exclude expression="(.*)\.svn"></exclude>
        <exclude expression="(.*)\.gz"></exclude>
        <exclude expression="^info/*"></exclude>
        <exclude expression="^static/*"></exclude>
</filter>

(.*)\.svn 排除.svn文件 
"(.*)\.gz 排除.gz文件
^info/*   以info开头的内容
^static/* 以static开头的内容

指定事件监控,可以开,关某些事件,看文件 12-21 行
true为检测,false为不检测
<inotify>
        <delete start="true"/>
        <createFolder start="true"/>
        <createFile start="false"/>
        <closeWrite start="true"/>
        <moveFrom start="true"/>
        <moveTo start="true"/>
        <attrib start="false"/>
        <modify start="false"/>
</inotify>


sersync重点配置,如rsync备份服务器的地址填写
localpath 本地目录 watch 进行监测(最好加上个/)
填写rsync备份服务器的地址,以及模块名
 <localpath watch="/data01/">
            <remote ip="192.168.178.122" name="backup"/>
            <!--<remote ip="192.168.8.39" name="tongbu"/>-->
            <!--<remote ip="192.168.8.40" name="tongbu"/>-->
 </localpath>
 
 
cat /etc/rsyncd.conf 查看rsync的配置

修改rsync服务器验证的账号密码配置
<rsync>
    <commonParams params="-artuz"/>
    <auth start="false" users="rsync_backup" passwordfile="/etc/rsync.password"/>
    <userDefinedPort start="false" port="874"/><!-- port=874 -->
    <timeout start="false" time="100"/><!-- timeout=100 -->
    <ssh start="false"/>
</rsync>
上一篇下一篇

猜你喜欢

热点阅读