一,安装:
wget
tar zxvf libevent-1.4.12-stable.tar.gz cd libevent-1.4.12-stable/ ./configure --prefix=/usr make && make install /sbin/ldconfig cd ../ wget tar zxvf gearmand-0.9.tar.gz cd gearmand-0.9/ ./configure make make install /sbin/ldconfig cd ../ wget tar zxvf gearman-0.5.0.tgz cd gearman-0.5.0 /usr/local/webserver/php/bin/phpize ./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-gearman make make install cd ../
二:启动服务
gearmand -L 127.0.0.1 -p 4730 -u root –d &
三:客户端脚本:
tail -F --sleep-interval=5 /home/wwwlogs/mvc_access.log > ./gearma.txt | cat gearma.txt | gearman -b -h 127.0.0.1 -f log >/dev/null &
四:work
exec("gearman -w -h 127.0.0.1 -f log >> /home/wwwroot/gearman/log.txt ");
五:设计架构:
日志汇总是从前端的任意多web服务器发送日志到汇总服务器,然后利用perl重新来统计数据,入库;