标签:
mkdir /server/tools -p wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gz tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz -C /usr/local cd /usr/local mv GNU-Linux-x86 sersync
[root@s sersync]# cd /usr/local/sersync/ [root@s sersync]# mkdir conf bin logs [root@s sersync]# mv confxml.xml conf [root@s sersync]# mv sersync2 bin/sersync [root@s sersync]# ll bin/ total 1768 -rwxr-xr-x.1 root root 1810128Oct26 2011 sersync [root@s conf]# cp /usr/local/sersync/conf/confxml.xml confxml.xml.bak
3.sersync文件配置
<?xml version="1.0" encoding="ISO-8859-1"?> <headversion="2.5"> <hosthostip="localhost"port="8008"></host> <debugstart="false"/> <--!调试模式是否打开--> <fileSystemxfs="false"/> <filterstart="false"> <--!文件过滤,定义哪些文件不同步--> <excludeexpression="(.*)\.svn"></exclude> <excludeexpression="(.*)\.gz"></exclude> <excludeexpression="^info/*"></exclude> <excludeexpression="^static/*"></exclude> </filter> <inotify> <--!定义监控哪些事件--> <deletestart="true"/> <createFolderstart="true"/> <createFilestart="false"/> <closeWritestart="true"/> <moveFromstart="true"/> <moveTostart="true"/> <attribstart="false"/> <modifystart="false"/> </inotify> <sersync> <localpathwatch="/data/www"> <--!本地需要推送到rsync服务器的目录--> <remoteip="192.168.1.161"name="backup"/> <--!需要同步到远端服务器的主机及rsync模块--> <!--<remote ip="192.168.8.39" name="tongbu"/>--> <!--<remote ip="192.168.8.40" name="tongbu"/>--> </localpath> <rsync> <commonParamsparams="-artuz"/> <--!同步的参数 --> <authstart="false"users="root"passwordfile="/etc/rsync.pas"/> <--!同步认证,同步用户名,同步密码文件--> <userDefinedPortstart="false"port="874"/><!-- port=874 --> <--!同步端口号--> <timeoutstart="false"time="100"/><!-- timeout=100 --> <--!同步超时时间,一般打开--> <sshstart="false"/> <--!ssh隧道是否开启,一般不开启--> </rsync> <failLogpath="/usr/local/sersync/logs/rsync_fail_log.sh"timeToExecute="60"/><!--default every 60mins execute once--> <--!传输失败队列,没60分钟执行一次--> <crontabstart="false"schedule="600"><!--600mins--> <--!定时传--> <crontabfilterstart="false"> <excludeexpression="*.php"></exclude> <excludeexpression="info/*"></exclude> </crontabfilter> </crontab> <pluginstart="false"name="command"/> </sersync> <pluginname="command"> <paramprefix="/bin/sh"suffix=""ignoreError="true"/><!--prefix /opt/tongbu/mmm.sh suffix--> <filterstart="false"> <includeexpression="(.*)\.php"/> <includeexpression="(.*)\.sh"/> </filter> </plugin> <pluginname="socket"> <localpathwatch="/opt/tongbu"> <deshostip="192.168.138.20"port="8009"/> </localpath> </plugin> <pluginname="refreshCDN"> <localpathwatch="/data0/htdocs/cms.xoyo.com/site/"> <cdninfodomainname="ccms.chinacache.com"port="80"username="xxxx"passwd="xxxx"/> <sendurlbase="http://pic.xoyo.com/cms"/> <regexurlregex="false"match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/> </localpath> </plugin> </head>
[root@s conf]# echo ‘export PATH=$PATH:/usr/local/sersync/bin‘>>/etc/profile [root@s conf]# source /etc/profile
[root@master www]# sersync -r -d -o /usr/local/sersync/conf/confxml.xml set the system param execute:echo 50000000 > /proc/sys/fs/inotify/max_user_watches execute:echo 327679 > /proc/sys/fs/inotify/max_queued_events parse the command param option: -r rsync all the local files to the remote servers before the sersync work option: -d run as a daemon option: -o config xml name: /usr/local/sersync/conf/confxml.xml daemon thread num: 10 parse xml config file XML Parsing error inside file ‘/usr/local/sersync/conf/confxml.xml‘. Warning: Unmatched end tag At line 52, column 15.
sersync -r 第一次全部同步 -o 指定配置文件 -n 指定线程总数 -d 后台服务 --help 帮助
7.sersync插件(开启插件设置),plugin设置为true时才生效,name为调用的插件,目前支持command refreshCDN socket http四中插件,http插件去除了
<plugin start="true" name="command"/>
sersync压力测试
[root@LB02 ~]# dmidecode | grep "Product Name" ProductName: IBM System x3650 M4:-[7915K3G]- ProductName:00MV214 [root@LB02 ~]# grep name /proc/cpuinfo model name :Intel(R)Xeon(R) CPU E5-2609 v2 @2.50GHz model name :Intel(R)Xeon(R) CPU E5-2609 v2 @2.50GHz model name :Intel(R)Xeon(R) CPU E5-2609 v2 @2.50GHz model name :Intel(R)Xeon(R) CPU E5-2609 v2 @2.50GHz [root@LB02 ~]# grep MemTotal/proc/meminfo MemTotal:32688332 kB tar -zxvf webbench-1.5.tar.gz cd webbench-1.5 make make install /usr/local/bin/webbench -t 100-c 1000 http://blog.xiaoyi.com/
#!/bin/sh count=80 while true do for((i=1;i<=$count;i++)) do /bin/cp 10k.jpg /backup/test/$i/10k_`echo $(date)$RANDOM|md5sum |cut -c 1-8`.jpg done sleep 1 for((i=1;i<=$count;i++)) do /bin/cp 30k.jpg /backup/test/$i/30k_`echo $(date)$RANDOM|md5sum |cut -c 1-8`.jpg done sleep 1 for((i=1;i<=$count;i++)) do /bin/cp 50k.jpg /backup/test/$i/50k`echo $(date)$RANDOM|md5sum |cut -c 1-8`.jpg done sleep 1 done
标签:
原文地址:http://www.cnblogs.com/sunmmi/p/5758567.html