gearmand的安装

1、安装gperf libuuid-devel
  yum install -y gperf libuuid-devel

2、安装 libevent
  yum install libevent libevent-devel

  如果libevent版本低,则手动安装

  wget https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/libevent-2.0.22-stable.tar.gz
  tar -zxvf libevent-2.0.22-stable.tar.gz
  cd libevent-2.0.22-stable
  ./configure
  make
  make install

3、添加环境变量
  echo export LD_LIBRARY_PATH=/usr/local/lib >> ~/.bash_profile
  shutdown -r now

4、安装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
  cd gearmand-1.1.12
  ./configure --prefix=/usr/local/gearmand (如果libevent安装时指定的目录,则带上参数 --with-libevent-prefix=/usr/lib64)
  make
  make install

5、安装成功图

    # /usr/local/gearmand/bin/gearman

6、创建日志/home/data/gearmand/gearmand.log
  # touch /home/data/gearmand/gearmand.log
    
7、启动

  # /usr/local/gearmand/sbin/gearmand -d -u root -L 192.168.161.136 --log-file=/home/data/gearmand/gearmand.log
  

  查是否运行
  # ps axu | grep gearmand
    
  查看监听端口
  # netstat -anp | grep 4730  centos6

  # ss -anp | grep 4730  centos7


8、安装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 --with-gearman=/usr/local/gearmand
  make
  make install
  安装成功后会显示gearman.so的路径,在php.ini文件中加入扩展

原文地址:https://www.cnblogs.com/oo-oo/p/gearman_setup.html