Gearman安裝及測試
一、本地環境安裝
伺服器環境:Ubuntu14.04
1. 獲取gearmand安裝包
> wgethttps://launchpad.net/gearmand/1.0/1.0.1/+download/gearmand-1.0.1.tar.gz
>tarxzvfgearmand-1.0.1.tar.gz
2. 配置
> cd gearmand
>./configure--prefix=/usr/local/gearmand
3. 解決包依賴問題【如果2執行出錯,根據錯誤提示分別安裝以下依賴包】
configure: error: could not find boost 錯誤解決
>apt-getinstalllibboost-all-dev
configure: error: could not find gperf 錯誤解決
>apt-getinstallgperf
configure: error: Unable to find libevent 錯誤解決
>apt-getinstalllibevent-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
轉載於:https://my.oschina.net/stream/blog/715072