分佈式調用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

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