1)安装
a)安装gcc4.4环境:
i. yum install gcc44 gcc44-c++ libstdc++44-devel gcc-c++ -y
ii. 在/etc/profile中添加环境变量export CC=/usr/bin/gcc、export CXX=/usr/bin/g++
iii. 执行source /etc/profile
b)安装boost开发库,版本必须大于1.39,这里安装最新的boost1.55,
i. ./bootstrap.sh
ii. sudo ./b2
iii. sudo ./b2 install --prefix=/usr
c)安装gperf、libevent和libuuid:
i.sudo yum install gperf
ii.sudo yum -y install libevent libevent-devel
iii.sudo yum -y install libuuid libuuid-devel
d)安装gearman
i.解压gearmand-1.1.12.tar.gz到当前文件夹,进入文件夹;
ii.运行./configure --with-boost-libdir=/usr/lib --prefix=/usr,安装到/usr路径下;
iii. make(如果提示myql错误,请安装yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql)
iv.sudo make install
v.建立log文件
- mkdir -p /usr/var/log/
- cd /usr/var/log/
- touch gearmand.log
2)启动
a)gearmand -d -u root
3)安装gearman-monitor
a)安装php的gearman扩展, gearman-1.1.2.tgz
i. cd gearman-1.1.2
ii.yum install php-devel
iii. phpize
iv. ./configure --prefix=/usr
v. make
vi. make install
b) 需要先安装Apache和PHP环境,将GearmanMonitor解压后文件放入到/var/www/html下新建文件夹gearman-monitor。
c) 将Net_Gearman-0.2.3解压到gearman-monitor下(替换已有的文件夹)。
d) 关掉selinux和防火墙,sudo setenforce 0
e) 编辑/etc/php.ini,在文件尾增加以下内容
i. extension_dir ="/usr/lib64/php/modules/"
ii.extension=gearman.so
f) 重启httpd即可。(service httpd restart)