Mac 下安装 Gearman 以及对应的 PHP 扩展.docx
- 文档编号:30387529
- 上传时间:2023-08-14
- 格式:DOCX
- 页数:7
- 大小:18.38KB
Mac 下安装 Gearman 以及对应的 PHP 扩展.docx
《Mac 下安装 Gearman 以及对应的 PHP 扩展.docx》由会员分享,可在线阅读,更多相关《Mac 下安装 Gearman 以及对应的 PHP 扩展.docx(7页珍藏版)》请在冰豆网上搜索。
Mac下安装Gearman以及对应的PHP扩展
Mac下安装Gearman以及对应的PHP扩展
Mac下安装Gearman以及对应的PHP扩展2014-06-03安装安装gearmand(gearman服务端)brewinstallgearmand上面的命令会一并安装libgearman库,而PHP扩展依赖该库,因此请确保gearmand先于PHP扩展安装。
直接使用pecl来安装php扩展:
peclinstallgearman基础使用如果需要开机启动gearman:
ln-sfv/usr/local/opt/gearman/*.plist~/Library/LaunchAgents
launchctlload~/Library/LaunchAgents/homebrew.mxcl.gearman.plist如果你不需要或者不想要launchctl,可以通过下面的命令来启动gearman守护进程:
gearmand-d命令行工具介绍安装完毕以后会生成三个可执行文件:
gearmandgearman守护进程,类似mysqld命令gearadmin如文件名,用于管理gearman,类似mysqladmin命令gearmangearman命令行客户端,类似mysql命令gearmandAllowedoptions:
Allowedoptions:
一般选项:
-b[--backlog]arg(=32)Numberofbacklogconnectionsfor
listen.-d[--daemon]守护进程模式。
立即结束命令行,在后台运行gearmand--exceptions默认启用协议层的异常Enableprotocolexceptionsbydefault.-f[--file-descriptors]arg进程最大可用的文件描述符数(总连接数会比这个数字略少)
默认使用的是当前用户最大可用数。
-h[--help]打印出这份帮助文档。
-j[--job-retries]arg(=0)在任务服务器移除任务之前尝试执行的最大次数。
设置
这个值这可以确保那些糟糕的任务不会crash掉所有
的工作线程。
默认值是0(即不限制次数)。
--job-handle-prefixarg用于生成任务处理器的字符串前缀。
如果没有提供,
默认值是“H:
<host_name>。
--hashtable-bucketsarg(=991)内部用于存放任务的哈希表(hashtables)的容量
默认使用的是991,可以支持包含300万个任务的
队列。
如果预计队列中的任务数将超过300万,请按比例设
置一个更大的数字。
例如,为了容纳2^32个任务,
本参数可设置为1733003。
这会消耗大约26MB的
额外内存。
到目前为止,`Gearmand`暂不支持超过
2^32个任务的队列。
--keepalive启用链接保持--keepalive-idlearg(=-1)如果启用了链接保持(--keepalive),请在支持
TCP_KEEPIDLE的系统上设置这个参数。
如果设置为
-1,则表示当系统不支持或者获取默认值事发生错误
使用该值。
Ifkeepaliveisenabled,setthevalue
forTCP_KEEPIDLEforsystemsthat
supportit.Avalueof-1meansthat
eitherthesystemdoesnotsupportit
oranerroroccurredwhentryingto
retrievethedefaultvalue.--keepalive-intervalarg(=-1)如果启用了链接保持(--keepalive),请在支持
TCP_KEEPINTVL的系统上设置这个参数。
如果设
置为-1,则表示当系统不支持或者获取默认值事发
生错误使用该值。
Ifkeepaliveisenabled,setthevalue
forTCP_KEEPINTVLforsystemsthat
supportit.Avalueof-1meansthat
eitherthesystemdoesnotsupportit
oranerroroccurredwhentryingto
retrievethedefaultvalue.--keepalive-countarg(=-1)如果启用了链接保持(--keepalive),请在支持
TCP_KEEPCNT的系统上设置这个参数。
如果设
置为-1,则表示当系统不支持或者获取默认值事发
生错误使用该值。
Ifkeepaliveisenabled,setthevalue
forTCP_KEEPCNTforsystemsthat
supportit.Avalueof-1meansthat
eitherthesystemdoesnotsupportit
oranerroroccurredwhentryingto
retrievethedefaultvalue.-l[--log-file]arg(=/usr/local/Cellar/gearman/1.1.9/var/log/gearmand.log)
用于写入错误日志和提示信息的日志文件。
如果
使用'stderr'作为该参数的值,则会输出到
stderr。
如果设置为'none',则不会生成日志
文件。
Logfiletowriteerrorsand
informationto.Ifthelog-file
parameterisspecifiedas'stderr',
thenoutputwillgotostderr.If
'none',thennologfilewillbe
generated.-L[--listen]arg服务器监听的地址,默认是任意地址(INADDR_ANY)Addresstheservershouldlistenon.
DefaultisINADDR_ANY.-P[--pid-file]arg(=/usr/local/Cellar/gearman/1.1.9/var/gearmand.pid)
用于写入进程ID的文件FiletowriteprocessIDoutto.-r[--protocol]arg加载指定协议模块Loadprotocolmodule.-R[--round-robin]按照工作线程连接服务器的顺序来分配任务。
默认值
是按照函数添加到工作线程的顺序来分配任务。
Assignworkinround-robinorderper
workerconnection.Thedefaultisto
assignworkintheorderoffunctions
addedbytheworker.-q[--queue-type]arg(=builtin)指定持久化队列的类型。
默认使用内建的队列。
Persistentqueuetypetouse.--config-filearg(=/usr/local/Cellar/gearman/1.1.9/etc/gearmand.conf)
也可以使用`@name`来指定。
Canbespecifiedwith'@name',too--syslog使用系统日志(syslog)。
Usesyslog.--coredump是否为未捕捉的信号创建一个核心转储。
Whethertocreateacoredumpfor
uncaughtsignals.-t[--threads]arg(=4)I/O线程的个数,如设置为0`gearmand`
将尝试猜测它能用的最大线程数。
默认是4。
NumberofI/Othreadstouse,0means
thatgearmandwilltrytoguessthe
maximumnumberitcanuse.Default=4.-u[--user]arg启动后切换到给定的用户Switchtogivenuserafterstartup.--verbosearg(=ERROR)设置日志记录级别Setverboselevel(FATAL,ALERT,
CRITICAL,ERROR,WARNING,NOTICE,INFO,
DEBUG).-V[--version]显示`gearmand`的版本号并退出。
Displaytheversionofgearmandandexit.-w[--worker-wakeup]arg(=0)当接收到任务时唤醒多少个工作线程。
默认会唤醒所
有可用的工作线程。
Numberofworkerstowakeupforeach
jobreceived.Thedefaultistowakeup
allavailableworkers.HTTP:
--http-portarg(=8080)监听的HTTP端口号Porttolistenon.Gear:
-p[--port]arg(=4730)服务将监听的端口号。
(Porttheservershouldlistenon.
--ssl启用SSL连接(Enablesslconnections.
--ssl-ca-filearg用于SSL连接的CA文件。
(CAfile.
--ssl-certificateargSSL证书(SSLcertificate.
--ssl-keyargSSL证书的密钥。
(SSLkeyforcertificate.builtin:
libmemcached:
--libmemcached-serversarg要使用的`Memcached`服务器列表。
ListofMemcachedserverstouse.libsqlite3:
--libsqlite3-dbarg使用的数据库文件。
Databasefiletouse.
--store-queue-on-shutdown关闭时持久化队列。
Storequeueonshutdown.
--libsqlite3-tablearg(=gearman_queue)
使用的表名,默认是`gearman_queue`。
Tabletouse.
首先来看看gearadmin命令。
Options:
--help查看相关帮助
-h[--host]arg(=localhost)要连接的host,默认为「localhost」(Connecttothehost)
-p[--port]arg(=4730)要连接到的端口号,默认为4730(Portnumberorservicetouseforconnection)
--server-version获得gearman服务器的版本号
--server-verbose获得服务器的详细设置
--create-functionarg从服务器创建一个函数
--cancel-jobarg从服务器中取消置顶的任务
--drop-functionarg从服务器中删除一个函数
--show-unique-jobs列出服务器上不重复的任务
--show-jobs列出服务器上所有的任务
--getpid获取服务器的进程ID
--status服务器的状态
--workers服务器的workers
--shutdown关闭服务器
-S[--ssl]启用SSL链接的支持
输入gearman命令即可查看gearman的相关帮助客户端模式:
gearman[options][<data>]
工作端模式:
gearman-w[options][<command>[<args>...]]客户端和工作端模式通用选项:
-f<function>-任务使用的函数名(可用指定多个)
Functionnametouseforjobs(cangivemany)-h<host>-任务服务器host
Jobserverhost-H-打印这份帮助
Printthishelpmenu-v-打印诊断信息到标准输出,默认为`false`
Printdiagnosticinformationtostdout(false)
-p<port>-任务服务器端口号
Jobserverport-t<timeout>-超时毫秒数
Timeoutinmilliseconds-i<pidfile>-为进程创建一个pid文件
Createapidfilefortheprocess-S-启用SSL连接
EnableSSLconnectionsClientoptions:
-b-在后台执行任务,默认为`false`(Runjobsinthebackground(false)
-I-高优先级执行任务。
(Runjobsashighpriority
-L-低优先级执行任务。
(Runjobsaslowpriority
-n-每行执行一个任务。
(Runonejobperline(false)
-N-等同`-n`,但去掉换行符。
Sameas-n,butstripoffthenewline(false)-P-使用指定函数名前置处理所有输出行。
Prefixalloutputlineswithfunctionsnames-s-不读取标准输入直接发送任务
Sendjobwithoutreadingfromstandardinput-u<unique>-为任务指定一个唯一key
UniquekeytouseforjobWorkeroptions:
-c<count>-退出前执行多少个任务。
Numberofjobsforworkertorunbeforeexiting-n-为每一行发送数据包。
Senddatapacketforeachline(false)-N-等同`-n`,但去掉换行符。
Sameas-n,butstripoffthenewline(false)-w-使用工作端模式运行。
(Runinworkermode(false)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Mac 下安装 Gearman 以及对应的 PHP 扩展 安装 以及 对应