Gearman安装及使用
基础安装包
- yum install vim wget gcc gcc-c++ make dos2unix gperf libevent libevent-devel zlib-devel bzip2-devel openssl-devel ncurses-devel boost boost-devel mysql-devel
安装gearman 异步队列
- # wget https://launchpad.net/gearmand/1.2/1.1.9/+download/gearmand-1.1.9.tar.gz
- # tar -zxvf gearmand-1.1.9.tar.gz
- # cd gearmand-1.1.9
- # ./configure 如果出现错误请查看下面的错误解决
成功后如下
- * LIBS:
- * LDFLAGS Flags:
- * Assertions enabled: no
- * Debug enabled: no
- * Warnings as failure: no
- * Building with libsqlite3 no
- * Building with libdrizzle no
- * Building with libmemcached not found
- * Building with libpq no
- * Building with tokyocabinet no
- * Building with libmysql yes
- * SSL enabled: no
- * make -j: 3
- * VCS checkout: no
- # make
- # make install
安装gearman php 扩展
- # wget http://pecl.php.net/get/gearman
- # mv gearman gearman.tar.gz
- # tar -zxvf gearman.tar.gz
- # cd gearman-1.1.2/
- # phpize
- # ./configure
- # make
- # make install
- # cd /etc/php.d/
- # cp gd.ini gearman.ini
- # vim gearman.ini
- ; Enable gearman extension module
- extension=gearman.so
- # service php-fpm restart
错误解决
在configure过程中出现了以下错误:
- checking for Boost headers version >= 1.39.0… no
- configure: error: cannot find Boost headers version >= 1.39.0
解决办法:
- # yum search boost
- # yum install boost.x86_64
- # yum install boost-devel.x86_64
继续执行./configure出现以下错误
- checking for gperf... no
- configure: error: could not find gperf
解决办法:
- #yum search gperf
- #yum install gperf.x86_64
继续执行./configure出现以下错误
- checking test for a working libevent... no
- configure: error: Unable to find libevent
解决办法:
- # yum install libevent libevent-devel
gearman 参数说明
- Client mode: gearman [options] [<data>]
- Worker mode: gearman -w [options] [<command> [<args> ...]]
- Common options to both client and worker modes.
- -f <function> - Function name to use for jobs (can give many)
- -h <host> - Job server host
- -H - Print this help menu
- -v - Print diagnostic information to stdout(false)
- -p <port> - Job server port
- -t <timeout> - Timeout in milliseconds
- -i <pidfile> - Create a pidfile for the process
- Client options:
- -b - Run jobs in the background(false)
- -I - Run jobs as high priority
- -L - Run jobs as low priority
- -n - Run one job per line(false)
- -N - Same as -n, but strip off the newline(false)
- -P - Prefix all output lines with functions names
- -s - Send job without reading from standard input
- -u <unique> - Unique key to use for job
- Worker options:
- -c <count> - Number of jobs for worker to run before exiting
- -n - Send data packet for each line(false)
- -N - Same as -n, but strip off the newline(false)
- -w - Run in worker mode(false)
gearman异步队列使用:
下面先做个命令行测试:
首先开两个命令行窗口:
tty1:
- # gearman -w -f abc -- wc -m
表示统计用户输入了多少个字符。
tty2:
- # gearman -f abc 'aaaa'
4
输出结果正确。
# gearman -f abc < /etc/php.ini
当然也可以直接从文件中读入内容。
Gearman安装及使用的更多相关文章
- gearman安装及初次使用
官网: http://gearman.org/ 一篇文章: 利用Gearman实现异步任务处理 一.问题分析 问题:在性能测试过程中,发现用户管理平台在进行图片上传时,性能不佳. 分析:经过代码分析 ...
- CentOS的Gearman安装
背景:用PHP做一些简单的上传是没有任何的问题,但是要做断点上传好像也是没有大问题,但要是并发的切片加断点上传可能就会有问题了哟.第一个问题是合并问题:如果一上传就合并,PHP老半天不返回是一个方面( ...
- gearman安装实录
花了5个小时装好了gearman,问题不断,坑爹的服务器yum还坏了,悲催. 服务器系统:centos5.3 64位 gearman版本:1.1.8 安装包(相关依赖)下载 1.gearman安装包 ...
- gearman 安装
yum install gperfyum install libevent-develyum install libuuid-develwget https://launchpad.net/gearm ...
- Gearman 安装使用教程
Gearman是一个分发任务的程序框架,可以用在各种场合,Gearman更偏向于任务分发功能.它的任务分布非常简单,简单得可以只需要用脚本即可完成. Gearman 分布式任务实现原理上只用到2个字段 ...
- gearman安装问题总结
解决configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. yum ...
- Centos7安装gearman和php扩展
Centos7安装gearman和php扩展 标签(空格分隔): php,linux gearman所需要的依赖 yum install \ vim \ git \ gcc \ gcc-c++ \ w ...
- gearman mysql udf
gearman安装 apt-get install gearman gearman-server libgearman-dev 配置bindip /etc/defalut/gearman-job-se ...
- Gearman + Nodejs + MySQL UDF异步实现 MySQL 到 Redis 的数据同步
[TOC] 1, 环境 CentOS, MySQL, Redis, Nodejs 2, Redis简介 Redis是一个开源的K-V内存数据库,它的key可以是string/set/hash/list ...
随机推荐
- tomcat下安装jenkins
参考网址:http://www.cnblogs.com/edward2013/p/5269465.html 5.安装Jenkins 方法1: jenkins.war下载地址: http://mir ...
- 洛谷 3784(bzoj 4913) [SDOI2017]遗忘的集合——多项式求ln+MTT
题目:https://www.luogu.org/problemnew/show/P3784 https://www.lydsy.com/JudgeOnline/problem.php?id=4913 ...
- js的模块化规范
js的模块化规范常见的有:AMD,CMD,commonJS,UMD,es6 前期在没有模块化的时候,js文件十分庞大,于是就按功能抽离划分为多个js文件. 但是在html页面通过script的方式加载 ...
- 剑指offer-python面试篇第一部分
互联网协议定义(分别有4层.5层及7层协议的说法,以下从上层向下层介绍)? a) 四层协议:应用层.传输层.网络层.网络接口层 a) 五层协议: 应用层:用户使用的应用程序都归属于应用层,作用为规定应 ...
- php 内容插入数据库需要mysql_escape_string处理一下 展示内容时候用htmlentities
php 内容插入数据库需要mysql_escape_string处理一下 mysql_escape_string (PHP 4 >= 4.0.3, PHP 5, 注意:在PHP5.3中已经弃用这 ...
- springMVC学习(9)-全局异常处理
一.异常处理思路: 系统中异常包括两类:预期异常和运行时异常RuntimeException,前者通过捕获异常从而获取异常信息,后者主要通过规范代码开发.测试通过手段减少运行时异常的发生. 系统的da ...
- 2018-2019 20165226 Exp5 MSF基础应用
2018-2019 20165226 Exp5 MSF基础应用 目录 一.实验内容说明及基础问题回答 二.实验过程 Task1 主动攻击实践 ms08_067 ms17_010 Task2 针对浏览器 ...
- javascript创建对象之寄生构造函数模式(六)
这种模式的基本思想是创建一个函数,该函数的作用仅仅是封装创建对象的代码,然后再返回新创建的对象; 但是从表面上看,这个函数有很像典型的构造函数. function createHuman(name,s ...
- vs2013编写的ASP.NET网站配置在XP IIS5.1上
1.vs创建项目时,选择.Net Framework2.0 2.配置网站属性 Step1.进入命令行,注册ASP.NET IIS cmd => cd "C:\WINDOWS\Mi ...
- php history.back返回后表单数据丢失的解决办法
js使用history.back返回表单数据丢失的主要原因就是使用了session_start();的原因,该函数会强制当前页面不被缓存.本文章向码农介绍php history.back返回后表单数据 ...