Ubuntu下Gearman安装搭建

参考文章http://gearman.org/getting-started/,进行以下操作。

1.更新

sudo apt-get update

下载gearmand-1.1.16.tar.gz ,地址: https://github.com/gearman/gearmand/releases

tar zxvf gearmand-1.1.16.tar.gz

cd gearmand-1.1.16/

./configure

configure: error: could not find boost

sudo apt-get install libboost-dev

接着重新执行:./configure

configure: error: Could not find a version of the library!

sudo apt-get install libboost-all-dev

接着重新执行:./configure

configure: error: could not find gperf

sudo apt-get install gperf*

接着重新执行:./configure

configure: error: Unable to find libevent

sudo apt-get install libevent-dev

接着重新执行:./configure

configure: error: Unable to find libuuid

安装libuuid

这里不能通过 sudo apt-get install 来安装了,找不到,通过下面方式安装

wget http://nchc.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz

sudo tar zxvf libuuid-1.0.3.tar.gz

cd libuuid-1.0.3/

./configure

sudo make

sudo make install


接下来继续上面的gearmand-1.1.16安装

./configure

sudo make

sudo make install

这里要等一段时间。。

//------------------------------------------------------------

没有错误,继续

gearman

第一次运行会看到以下提示:

gearman: error while loading shared libraries: libgearman.so.8: cannot open shared object file: No such file or directory

(这表示系统不知道libgearman.so.8 放在哪个目录下。 要在/etc/ld.so.conf中加入libgearman.so.8所在的目录。 检查了下,文件所在目录为/usr/local/lib。 因此出现这个问题的原因是libgearman.so.8刚生成,没有加入到ld.so.cache中,所以这时需要重新运行一下 /sbin/ldconfig( ldconfig命令的作用):)

sudo /sbin/ldconfig

此时再执行 gearman 则已安装成功!

安装完Job Server之后,用gearmand –d命令启动

gearmand -d

第一次运行会看到以下提示:

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

在提示的目录下创建好/log/gearmand.log文件,再次执行上述命令,就正常启动了job server。

sudo gearmand -d

到这里就已经完全ok了

//------------------------------------------------------------

安装PHP Gearman扩展

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

sudo tar zxvf gearman-1.1.2.tgz

cd gearman-1.1.2/

sudo phpize

sudo ./configure  --with-php-config=/usr/local/php/bin/php-config

sudo make

sudo make install

sudo echo "extension=gearman.so" >> /usr/local/php/etc/php.ini (注意这里php.ini位置)

sudo /usr/local/apache/bin/apachectl restart

这时查看php_info时就应该看到 gearman扩展了

php --info |grep gearman



//------------------------------------------------------------

Calabash+Gearman实现多手机同步测试机制  http://www.linuxidc.com/Linux/2015-01/111587.htm

分布式的任务分发框架-Gearman http://www.linuxidc.com/Linux/2015-01/111385.htm

使用supervisor监控Gearman任务的例子见:http://www.linuxidc.com/Linux/2015-01/111384.htm

通过Gearman实现MySQL到Redis的数据同步(异步复制) http://www.linuxidc.com/Linux/2015-01/111380.htm

本文永久更新链接地址http://www.linuxidc.com/Linux/2016-03/129348.htm




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