分布式调用gearman安装

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

操作系统  LINUX Centos6.6 64位

环境lnmp

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

gearman,官网 (http://gearman.org/)下载地址(https://launchpad.net/gearmand/+download)从名字上看叫做“齿轮工”,就是通过齿轮把不同的组件组合在一起。通常,多语言多系统之间的集成是项目开发中一个比较头疼的问 题。一般会采用RPC风格或者是REST风格的WebService。但是总感觉比较麻烦。gearman就应运而生了,作为一个任务分发架构,它能够轻 松的将前端的任务通过Job Server分发给后端的Worker处理。Gearman请求的处理过程涉及三个角色:Client -> Job Server -> Worker。

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

Client:请求的发起者,可以是C,PHP,Perl,MySQL UDF等等。

Job Server:请求的调度者,用来负责协调把Client发出的请求转发给合适的Worker。

Worker:请求的处理者,可以是C,PHP,Perl等等。

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

安装服务端gearmand

(一)yum安装依赖

yum install boost-devel* gperf* libevent-devel* libuuid-devel gcc-c++ gcc

(二)获取gearmand包

wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz

解压

 tar zxvf gearmand-1.1.12.tar.gz

进入到解压目录

 ./configure 

make &&  make install

启动 gearmand -d

常见问题:

(1)提示找不到boost>=1.39,明明已经安装了,这里应该是没有安装gcc-c++,有的机器有gcc却不一定带有gcc-c++。

解决方法 

yum install gcc-c++应该就可以了。或者版本有问题 换个版本再试试。

(2)gearmand: Could not open log file "/usr/local/var/log/gearmand.log", from "/shell/gearmand-1.1.12", switching to stderr. (No such file or directory)

解决方法 

cd  /usr/local/   mkdir -p  var/log     touch  gearmand.log  然后再重启就没有问题了应该

netstat -nltp

会看到 gearmand 的进程 端口是4730

安装gearman的php扩展

wget http://pecl.php.net/get/gearman-1.1.2.tgz

tar zxvf gearman-1.1.2.tgz

cd gearman-1.1.2

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config
make && make install


在php.ini末尾加上extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/gearman.so,

重启apache,输出php –info |grep “gearman”或者php -m或者网页输出phpinfo()都能看到已经安装成功。

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

gearmand

centos5.8

安装http://www.verydemo.com/demo_c116_i46619.html

  • Boost.IOStreams Bzip2 filters

  • Boost.IOStreams Zlib filters

  • Boost.MPI

  • Boost.Python

  • Boost.Regex ICU support

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章