服务启动

使用yum 的安装包

  • 安装server
yum install  -y gearmand
  • 启动
systemctl restart  gearmand
 

启动worker

gearman -w -f  date -- date
 

启动client 调用

gearman -f data  -s
 

效果

2019年 01月 18日 星期五 10:31:29 CST
 

参数说明

  • client && worker
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
  -S - Enable SSL connections
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)
 
 
  • server
    从参数我们也可以看出,支持多种后端的数据存储
 
Allowed options:
Allowed options:
General options:
  -b [ --backlog ] arg (=32) Number of backlog connections for
                                        listen.
  -d [ --daemon ] Daemon, detach and run in the
                                        background.
  --exceptions Enable protocol exceptions by default.
  -f [ --file-descriptors ] arg Number of file descriptors to allow for
                                        the process (total connections will be
                                        slightly less). Default is max allowed
                                        for user.
  -h [ --help ] Print this help menu.
  -j [ --job-retries ] arg (=0) Number of attempts to run the job
                                        before the job server removes it. This
                                        is helpful to ensure a bad job does not
                                        crash all available workers. Default is
                                        no limit.
  --job-handle-prefix arg Prefix used to generate a job handle
                                        string. If not provided, the default
                                        "H:<host_name>" is used.
  --hashtable-buckets arg (=991) Number of buckets in the internal job
                                        hash tables. The default of 991 works
                                        well for about three million jobs in
                                        queue. If the number of jobs in the
                                        queue at any time will exceed three
                                        million, use proportionally larger
                                        values (991 * # of jobs / 3M). For
                                        example, to accomodate 2^32 jobs, use
                                        1733003. This will consume ~26MB of
                                        extra memory. Gearmand cannot support
                                        more than 2^32 jobs in queue at this
                                        time.
  --keepalive Enable keepalive on sockets.
  --keepalive-idle arg (=-1) If keepalive is enabled, set the value
                                        for TCP_KEEPIDLE for systems that
                                        support it. A value of -1 means that
                                        either the system does not support it
                                        or an error occurred when trying to
                                        retrieve the default value.
  --keepalive-interval arg (=-1) If keepalive is enabled, set the value
                                        for TCP_KEEPINTVL for systems that
                                        support it. A value of -1 means that
                                        either the system does not support it
                                        or an error occurred when trying to
                                        retrieve the default value.
  --keepalive-count arg (=-1) If keepalive is enabled, set the value
                                        for TCP_KEEPCNT for systems that
                                        support it. A value of -1 means that
                                        either the system does not support it
                                        or an error occurred when trying to
                                        retrieve the default value.
  -l [ --log-file ] arg (=/var/log/gearmand.log)
                                        Log file to write errors and
                                        information to. If the log-file
                                        parameter is specified as 'stderr',
                                        then output will go to stderr. If
                                        'none', then no logfile will be
                                        generated.
  -L [ --listen ] arg Address the server should listen on.
                                        Default is INADDR_ANY.
  -P [ --pid-file ] arg (=/var/gearmand.pid)
                                        File to write process ID out to.
  -r [ --protocol ] arg Load protocol module.
  -R [ --round-robin ] Assign work in round-robin order per
                                        worker connection. The default is to
                                        assign work in the order of functions
                                        added by the worker.
  -q [ --queue-type ] arg (=builtin) Persistent queue type to use.
  --config-file arg (=/etc/gearmand.conf)
                                        Can be specified with '@name', too
  --syslog Use syslog.
  --coredump Whether to create a core dump for
                                        uncaught signals.
  -t [ --threads ] arg (=4) Number of I/O threads to use, 0 means
                                        that gearmand will try to guess the
                                        maximum number it can use. Default=4.
  -u [ --user ] arg Switch to given user after startup.
  --verbose arg (=ERROR) Set verbose level (FATAL, ALERT,
                                        CRITICAL, ERROR, WARNING, NOTICE, INFO,
                                        DEBUG).
  -V [ --version ] Display the version of gearmand and
                                        exit.
  -w [ --worker-wakeup ] arg (=0) Number of workers to wakeup for each
                                        job received. The default is to wakeup
                                        all available workers.
HTTP:
  --http-port arg (=8080) Port to listen on.
Gear:
  -p [ --port ] arg (=4730) Port the server should listen on.
  --ssl Enable ssl connections.
  --ssl-ca-file arg CA file.
  --ssl-certificate arg SSL certificate.
  --ssl-key arg SSL key for certificate.
builtin:
libmemcached:
  --libmemcached-servers arg List of Memcached servers to use.
libsqlite3:
  --libsqlite3-db arg Database file to use.
  --store-queue-on-shutdown Store queue on shutdown.
  --libsqlite3-table arg (=gearman_queue)
                                        Table to use.
Postgres:
  --libpq-conninfo arg PostgreSQL connection information string.
  --libpq-table arg (=queue) Table to use.
libtokyocabinet:
  --libtokyocabinet-file arg File name of the database. [see: man tcadb,
                              tcadbopen() for name guidelines]
  --libtokyocabinet-optimize Optimize database on open. [default=true]
MySQL:
  --mysql-host arg (=localhost) MySQL host.
  --mysql-port arg (=3306) Port of server. (by default 3306)
  --mysql-user arg MySQL user.
  --mysql-password arg MySQL user password.
  --mysql-db arg MySQL database.
  --mysql-table arg (=gearman_queue) MySQL table name.
 
 
  • admin 参数
Options:
  --help Options related to the program.
  -h [ --host ] arg (=localhost) Connect to the host
  -p [ --port ] arg (=4730) Port number or service to use for connection
  --server-version Fetch the version number for the server.
  --server-verbose Fetch the verbose setting for the server.
  --create-function arg Create the function from the server.
  --cancel-job arg Remove a given job from the server's queue
  --drop-function arg Drop the function from the server.
  --show-unique-jobs Show unique jobs on server.
  --show-jobs Show all jobs on the server.
  --getpid Get Process ID for the server.
  --status Status for the server.
  --workers Workers for the server.
  --shutdown Shutdown server.
  -S [ --ssl ] Enable SSL connections.

参考资料

http://gearman.org/getting-started/

gearman 简单试用的更多相关文章

  1. jQuery无刷新上传之uploadify简单试用

    先简单的侃两句:貌似已经有两个月的时间没有写过文章了,不过仍会像以前那样每天至少有一至两个小时是泡在园子里看各位大神的文章.前些天在研究“ajax无刷新上传”方面的一些插件,用SWFUpload实现了 ...

  2. cloudevents js sdk 简单试用

    cloudevents 目前官方提供了不同语言的sdk,以下是js 的简单学习试用,从目前来说更新不是很好 clone 代码 git clone https://github.com/cloudeve ...

  3. podium micro-frontends 简单试用

    以下是一个简单的podium 试用,包含了layout 以及podlets,使用docker 运行 podium 主要包含了两大部分 podlets 片段服务 layouts 片段组合服务 环境准备 ...

  4. Visual Studio Code 的简单试用体验

    首先对Visual Studio Code做一个大概的介绍.首先明确一下,这个Visual Studio Code(以下简称 vscode)是一个带GUI的代码编辑器,也就是只能完成简单的代码编辑功能 ...

  5. Cassandra安装及其简单试用

    官方主页:http://cassandra.apache.org/ 简介: The Apache Cassandra Project develops a highly scalable second ...

  6. nginx ngx_http_image_filter_module 简单试用

    nginx包含了一个ngx_http_image_filter_module 模块,我们可以方便的进行图片的缩略图,平时一些简单的功能 已经够用了 环境准备 为了简单使用docker-compose ...

  7. Apigee 简介与简单试用

     Apigee (国内访问需要***)是一家成立于2004年的API管理公司,于2016年9月被Google收购,作为Google云的服务之一.Apigee提供从API设计.开发.管理.门户.网关等 ...

  8. vernemq 集群 docker-compose 搭建简单试用

    vernemq 是一款开源的mqtt broker, 支持cluster 模式部署,而且部署比较简单 以下是一个使用docker-compose 搭建环境的demo 环境准备 docker-compo ...

  9. tailor+ skipper 实现micro-frontends 简单试用

    tailor 在Mosaic 框架中扮演fragment 模版layout的处理,后端fragment可以用任何服务编写 tailor 主要就是进行layout的处理.tailor的是类似facebo ...

随机推荐

  1. js call回调的this指向问题

    function fn1(){ console.log(1); } function fn2(){ console.log(2); } fn1.call(fn2); //输出 1 fn1.call.c ...

  2. 用postman做自动化测试

    pre-request script: pm.environment.set("title", data.title);pm.environment.set("tab&q ...

  3. loadrunner json参数化

    因为json格式有{},所以LR参数化时如果也用默认的{}的话,会冲突,这样脚本运行时就无法识别,导致不能正确的读取参数化文件里的内容,此时把参数化的{}改成其他符号即可,比如<>

  4. js 冒泡事件阻止 父层事件影响子层

    当父层 与子层 有相同的事件时,但子层跟父层执行的内容却不一样时 为了 防止 父层事件对子层造成影响我们可以在子层的方法里做如下操作 function A (event){ event.stopPro ...

  5. socket 编程通信实例

    socket 编程通信实例:TCPserver: , ServerThread,  ;    WSADATA wsaData;    ,),  ;    }    ;    }    } ;    g ...

  6. Java类库和常用类库介绍

    Java 类库概念: Java 的应用程序接口 (API) 以包的形式来组织,每个包提供了大量的相关类.接口和异常处理类,这些包的集合就是 Java 的类库 包名以 Java 开始的包是 Java 核 ...

  7. swiper 支持性

    Swiper3 是一款免费以及轻量级的移动设备触控滑块的js框架,使用硬件加速过渡(如果该设备支持的话).主要使用于移动端的网站.移动web apps,native apps和hybrid apps. ...

  8. 『转』android官网翻译好的蓝牙API接口说明

    Develop API Guides 连接 蓝牙 本文内容 基础知识 蓝牙权限 设置蓝牙 查找设备 查询配对的设备 发现设备 连接设备 连接为服务器 连接为客户端 管理连接 使用配置文件 供应商特定的 ...

  9. C点滴成海------Ubuntu怎么运行C语言

    Ubuntu怎么运行C语言 一.安装相关软件 安装vim:输入 sudo apt-get install vim: 安装gcc:输入 sudo apt-get install g++. 二.编写代码 ...

  10. 初识linux------用户和用户组

    事先说明 本Linux的版本为Ubuntu. 为避免一些初学者由于权限问题特此事先说明,在非root权限下时,所有的代码加sudo:如下 (1)不在root权限 sudo useradd -m 用户名 ...