您的位置:首页 > 其它

LAMP 网页镜像同步

2011-11-27 02:08 218 查看
同步rsyncd设置 rsyncd软件包

1. rsyncd配置文件

vi /etc/rsyncd.conf

uid=root
gid=root
use chroot=no
max connections=20

pid file= /var/run/rsyncd.pid
lock file= /var/run/rsyncd.lock
log file= /var/run/rsyncd.log

[web]

path=/var/www/html/bbs/
lgnore errors
read only=yes
hosts allow=169.254.1.0/16
hosts deny = 0.0.0.0/32

2. 启动rsync 守护进程

/usr/bin/rsync --daemon
-----------------------------------------------

mkdir /var/www/html/bbs/

vi /var/www/html/bbs/abc.txt

在本机上测试
rsync -av 169.254.1.233::web /tmp/bbs/ 测试本地同步

在客户机上测试

rsync -av 169.254.1.233::web ./bbs/ 测试非本地同步

--------------------------------------

windows 客户端批处理

2秒中自动同步

@echo off
:1
echo 同步中

rsync -av 169.254.1.233::web \bbs\

ping 127.0 -n 2 >nul 2>nul

goto 1

-----------------------------------------

linux 自动同步

脚本

#!/bin/bash

while true

do

/usr/bin/rsync -av 169.254.1.233::web ./bbs/ >/dev/null 2 >&1

sleep 20

done
--------------------------------------------

rsync -vzrtopg 169.254.1.233::web ./bbs/

参数
-----------------------------------

站点压力测试

安装

tar zxvf webbench-1.5.tar.gz

cd webbench-1.5

make && make install

测试

webbench -c 650 -t 30 http://127.0.0.1/test.php
参数说明: -c 表示并发数 -t 表示时间秒
本文出自 “我是一只小小鸟” 博客,请务必保留此出处http://litclive.blog.51cto.com/628198/726119
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: