利用Samba搭建Backup Server配置文件

简介: backup server

1. Backup Sever IP:192.168.0.251 独立机器

2.相关软件

  • 1.sersync2+rsync
  • 2.samba

3.相关配置文件

rsync.conf

[root@Backup ~]# cat /etc/rsyncd.conf 
uid=root
gid=root
max connections=36000
use chroot=no
log file=/var/log/rsyncd.log
lock file=/var/run/rsyncd.lock

[tongbu]
path=/backup/ #同步到本地的目录
ignore errors=yes
read only=no
hosts allow=*

[root@Backup ~]# 

sersync中confxml.xml文件配置

[root@Backup GNU-Linux-x86]# cat confxml.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.5">
<host hostip="localhost" port="8008"></host>
<debug start="false"/>
<fileSystem xfs="false"/>
<filter start="false">
<exclude expression="(.*)\.svn"></exclude>
<exclude expression="(.*)\.gz"></exclude>
<exclude expression="^info/*"></exclude>
<exclude expression="^static/*"></exclude>
</filter>
<inotify>
<delete start="true"/>
<createFolder start="true"/>
<createFile start="true"/>
<closeWrite start="true"/>
<moveFrom start="true"/>
<moveTo start="true"/>
<attrib start="true"/>
<modify start="true"/>
</inotify>

<sersync>
<localpath watch="/data">
<remote ip="127.0.0.1" name="tongbu"/>
</localpath>
<rsync>
<commonParams params="-artu"/>
<auth start="false" users="root" passwordfile="/etc/rsync.pas"/>
<userDefinedPort start="false" port="874"/><!-- port=874 -->
<timeout start="false" time="100"/><!-- timeout=100 -->
<ssh start="false"/>
</rsync>
<failLog path="/tmp/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once-->
<crontab start="false" schedule="600"><!--600mins-->
<crontabfilter start="false">
<exclude expression="*.php"></exclude>
<exclude expression="info/*"></exclude>
</crontabfilter>
</crontab>
<plugin start="false" name="command"/>
</sersync>

<plugin name="command">
<param prefix="/bin/sh" suffix="" ignoreError="true"/> <!--prefix /opt/tongbu/mmm.sh suffix-->
<filter start="false">
<include expression="(.*)\.php"/>
<include expression="(.*)\.sh"/>
</filter>
</plugin>

<plugin name="socket">
<localpath watch="/opt/tongbu">
<deshost ip="192.168.138.20" port="8009"/>
</localpath>
</plugin>
<plugin name="refreshCDN">
<localpath watch="/data0/htdocs/cms.xoyo.com/site/">
<cdninfo domainname="ccms.chinacache.com" port="80" username="xxxx" passwd="xxxx"/>
<sendurl base="http://pic.xoyo.com/cms"/>
<regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/>
</localpath>
</plugin>
</head>
[root@Backup GNU-Linux-x86]# 

samba配置文件

[root@Backup /]# cat /etc/samba/smb.conf
[global]
workgroup = WORKGROUP 
server string = Samba Server Version %v
security = share
log file = /var/log/samba/log.%m
max log size = 50
idmap config * : backend = tdb

[public]
comment = Public Stuff
path = /data/Development/samba
guest ok = Yes
browseable = Yes
writable = Yes
write list = @nobody
create mask = 777
directory mask = 777


[root@Backup /]#

4.注意事项

samba中确保setlinux关闭,用setenforce 0命令执行默认的,SELinux禁止网络上对Samba服务器上的共享目录进行写操作,即使你在smb.conf中允许了这项操作

samba中挂载:

mount -t cifs -o username=root //192.168.0.251/public /WGY/
目录
相关文章
|
网络安全 数据安全/隐私保护 Windows
|
监控 Apache 应用服务中间件
|
监控 Linux 关系型数据库
|
Apache 数据安全/隐私保护 PHP
|
数据库 关系型数据库 MySQL