1.首先下載所需軟體
wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download
wget https://launchpad.net/gearmand/1.2/1.1.6/+download/gearmand-1.1.6.tar.gz
wget http://pecl.php.net/get/gearman-1.1.1.tgz
wget http://ncu.dl.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.zip
2.安裝編譯軟體
tar zxvf libevent-2.0.20-stable.tar.gz
cd libevent-2.0.20-stable
./configure --prefix=/usr
make
make install
/sbin/ldconfig
unzip boost_1_53_0.zip
cd boost_1_53_0
./bootstrap.sh --prefix=/opt/local/boost-1.53
vi tools/build/v2/user-config.jam
在最後增加
using mpi
./b2
./b2 install
tar zxvf gearmand-1.1.6.tar.gz
cd gearmand-1.1.6
./configure --with-boost=/opt/local/boost-1.53
make
make install
/sbin/ldconfig
tar -zxvf re2c-0.13.5.tar.gz
cd re2c-0.13.5
./configure
make
make install
tar zxvf gearman-1.1.1.tgz
cd gearman-1.1.1
/opt/local/php/bin/phpize
./configure --with-php-config=/opt/local/php/bin/php-config --with-gearman
make
make install
3. 編輯 php.ini
vi php.ini
增加
extension = "gearman.so"
重啟php
4. 啟動gearmand 服務
gearmand -L 10.6.0.6 -p 4730 -u root -l /var/log/gearmand.log -d
其他引數請 gearmand --help
5. 一個監控的工具
wget https://nodeload.github.com/yugene/Gearman-Monitor/zip/master
ps:
錯誤.1
error: tr1/cinttypes: No such file or directory
yum install gcc44 gcc44-c++ libstdc++44-devel
export CC="gcc44"
export CXX="g++44"
錯誤.2
configure: error: Please install libgearman
export GEARMAN_LIB_DIR=/usr/include/libgearman
export GEARMAN_INC_DIR=/usr/include/libgearman
錯誤.3
libhostile/function.c: In function 'print_function_cache_usage':
libhostile/function.c:54: error: 'for' loop initial declarations are only allowed in C99 mode
libhostile/function.c:54: note: use option -std=c99 or -std=gnu99 to compile your code
那是因為 C++ 預設是用 c89 來編譯的···需要更改成 c99 編譯!
./configure 以後
vim Makefile
搜搜 CC
這裡更改為
CC = gcc44 -std=c99
-------------------------------------------------------------------------------------
錯誤.4
collect2: ld returned 1 exit status
make[1]: *** [benchmark/blobslap_worker] Error 1
GOOGLE 解決辦法
cd /opt/local/boost-1.53/lib
cp -rf * /usr/lib/;
cp -rf * /usr/lib64/;
ln -s /opt/local/boost-1.53/include/boost /usr/include/boost
-------------------------------------------------------------------------------------
錯誤.5
gearmand make 出現 sqlite3 的錯誤.. 找不到解決辦法~只能在configure 裡把 sqlite3 先關閉掉...
./configure --with-boost=/opt/local/boost-1.53 --with-sqlite3=no