一、本地环境安装
服务器环境: Ubuntu 14.04
1. 获取gearmand安装包
> wget https://launchpad.net/gearmand/1.0/1.0.1/+download/gearmand-1.0.1.tar.gz
> tar xzvf gearmand-1.0.1.tar.gz
2. 配置
> cd gearmand
> ./configure --prefix=/usr/local/gearmand
3. 解决包依赖问题【如果2执行出错,根据错误提示分别安装以下依赖包】
configure: error: could not find boost 错误解决
> apt-get install libboost-all-dev
configure: error: could not find gperf 错误解决
> apt-get install gperf
configure: error: Unable to find libevent 错误解决
> apt-get install libevent-dev
configure: error: Unable to find libuuid 错误解决
> apt-get install libuuid-devel
4. Make
> make
> make install
5. 启动
> /usr/local/gearmand/sbin/gearmand -d -l /home/gearmandlogs/access.log
二、测试代码编写[Python]
Python 2.7
1. Python安装Gearman支持
>easy_install gearman
2. worker.py
图-2-001 worker.py
3. client.py
图-2-002 client.py
4. 执行效果截图
图-2-003 worker.py
图-2-004 client.py
三、源码地址
http://git.oschina.net/alan.h/Gearman-Python
四、参考资料
http://gearman.org/getting-started/
https://pythonhosted.org/gearman/library.html
来源:oschina
链接:https://my.oschina.net/u/167160/blog/715072