Gearman安裝及測試

1、本地環境安裝html

服務器環境: Ubuntu 14.04python

 

1. 獲取gearmand安裝包git

> 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. 配置ui

> cd gearmand.net

> ./configure --prefix=/usr/local/gearmandhtm

 

3. 解決包依賴問題【若是2執行出錯,根據錯誤提示分別安裝如下依賴包】get

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

 

2、測試代碼編寫[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

3、源碼地址

http://git.oschina.net/alan.h/Gearman-Python

4、參考資料

http://gearman.org/getting-started/

https://pythonhosted.org/gearman/library.html

相關文章
相關標籤/搜索