gearman

Starting multiple upstart instances automatically

╄→гoц情女王★ 提交于 2019-11-29 19:53:46
We use PHP gearman workers to run various tasks in parallel. Everything works just fine, and I have silly little shell script to spin them up when I want them. Being a programmer (and therefore lazy), I wanted to see if I could spin these up via an upstart script. I figured out how to use the instance stanza, so I could start them with an instance number: description "Async insert workers" author "Mike Grunder" env SCRIPT_PATH="/path/to/my/script" instance $N script php $SCRIPT_PATH/worker.php end script And this works great, to start them like so: sudo start async-worker N=1 sudo start async

如何在基于 Docker 的 PHP 环境安装 Gearman 扩展

余生长醉 提交于 2019-11-29 18:27:15
在 pecl 中的扩展 gearman 已经很久没有更新,最新是 2013 年发布的 gearman-1.1.2.tgz,该版本只支持 PHP7 以下的版本。如果想 在 PHP7.0+ 的环境中安装 Gearman 扩展,需要通过源码编译的方式安装。 说明 :Gearman 依赖 Gearmand 服务,Gearmand 又依赖 libuuid 包。 完整的 Dockerfile 示例如下: FROM php:7.0-apache # 修改软件更新源 COPY ./source.list /etc/apt/sources.list RUN apt-get update \ # 安装扩展依赖包 && apt-get install -y wget \ # 下载源码包:gearman && mkdir -p /tmp/gearmand /tmp/gearman /tmp/libuuid \ && wget -c https://github.com/gearman/gearmand/releases/download/1.1.18/gearmand-1.1.18.tar.gz \ && tar -xf gearmand-1.1.18.tar.gz -C /tmp/gearmand --strip-components=1 \ && wget -c https://github.com

gearman gives me GEARMAN_COULD_NOT_CONNECT, it is definitely running

Deadly 提交于 2019-11-29 06:49:44
My dev server is Debian Squeeze and I'm running Gearman 1.1.5 which I compiled from source along with the php pecl extension v1.1.1 If I run the reverse_client.php script I get the GEARMAN_COULD_NOT_CONNECT error. PHP Warning: GearmanClient::do(): send_packet(GEARMAN_COULD_NOT_CONNECT) Failed to send server-options packet -> libgearman/connection.cc:430 in /home/bealers/build/gearman-1.1.1/examples/reverse_client.php on line 26 There are a few similar posts on here about this and they all point to GM not running. It is definitely running. I'm starting it with these params: PARAMS="--queue-type

Schedule a job in Gearman for a specific date and time

五迷三道 提交于 2019-11-29 00:15:05
From what I can see Gearman does not support scheduled jobs or delayed jobs. I was thinking that perhaps the scheduled job could be queued in at first and then added to the Gearman queue after the at time period has expired. at tasks are persistent as they are written as files to a directory in the spool directory of the server. So the only bottle neck would potentially be a simple script to add the task to the Gearman queue because at can't be distributed across servers. Passing it to Gearman to process the actual job means I can get proper job logging etc. Is this the best way to approach

Running Gearman Workers in the Background

吃可爱长大的小学妹 提交于 2019-11-28 23:07:48
问题 I'm using Ubuntu Natty with PHP 5.3.8. I just got Gearman working on my server. I did a few tests with some scripts I got off the PHP Manual, and everything works ok. However, I'd like to know if there's a way I can run the worker in the background, and also monitor it so that when I move to a multi-worker situation, I can keep track of just how many workers I've got working. Usually, I would have to open two terminals, one for the worker and one for the client. The one for the worker becomes

asynchronous processing with PHP - one worker per job

浪子不回头ぞ 提交于 2019-11-28 18:59:08
Consider a PHP web application whose purpose is to accept user requests to start generic asynchronous jobs, and then create a worker process/thread to run the job. The jobs are not particularly CPU or memory intensive, but are expected to block on I/O calls fairly often. No more than one or two jobs should be started per second, but due to the long run times there may be many jobs running at once. Therefore, it's of utmost importance that the jobs run in parallel. Also, each job must be monitored by a manager daemon responsible for killing hung workers, aborting workers on user request, etc.

CentOS 6 安装 gearman 和它的 php 扩展

泪湿孤枕 提交于 2019-11-28 18:23:37
0. PHP 中的 gearman 扩展 我的服务器使用的是 ius 的 php5.5 ,如果你使用其他源和版本,请自行替换部分包名 1. 安装 epel 和 ius 源 yum install http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/epel-release-6-5.noarch.rpm yum install http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm 2. 安装 gearman ,用于运行 gearman 服务 yum install gearmand 3. 安装 libgearman 和 libgearman-devel ,用于编译 php 扩展 yum install libgearman libgearman-devel 4. 安装 pecl 和其他依赖 yum install php-pear php55u-devel 5. 安装 php 扩展 pecl install gearman 6. 修改配置文件 /etc/php.ini 增加 extension=gearman.so You should add "extension

Gearman: Sending data from a background worker to the client

梦想与她 提交于 2019-11-28 08:12:58
问题 Is it possible to send back data from a gearman worker that runs in the background (with PHP)? I know that I can pass a status (numerator/denominator) to the client but I need to "return" data. The background is that I need to call workers on different servers and if they don't respond, the main script should continue. So I think I have to run the workers in the background. But I need some data from them. UPDATE: It seems not to be possible. I think I have either to store the data in a shared

Any way to access Gearman administration?

蹲街弑〆低调 提交于 2019-11-28 03:20:59
I want to be able to query a gearman server to determine how many instances of a worker I have running (basically I want to make sure that RunTaskA is available and RunTaskB is available if there are no workers handling those tasks, I want to be able to send an alert out. Is there any way to do this? Also: Mad props if you know of a PHP way to query the gearman server. Edit : I know about the PHP gearman extension that is available natively, but I am not looking for a task submission extension, I need something that allows me to query the gearman server and see how many workers are serving a

How can i install gearman php extension on Windows OS?

回眸只為那壹抹淺笑 提交于 2019-11-28 01:26:44
Please anybody help me out in installing gearman php extension on windows xp. I have xampp 1.7.7 installed on my system and i have installed Cygwin, libevent-1.4.14b-stable and gearmand on my system. Please let me know what more is needed to install gearman-1.0.2 php extension. As when i run the gearman-1.0.2 on cygwin terminal throwing error of command not found. RafaSashi to install Gearman with PHP Extension in CentOS or Debian see How to install Gearman with PHP Extension Installing and Updating Cygwin Package from: https://cygwin.com/install.html Install the Latest GCC and make via Cygwin