gearman

gearman 任务分发系统PHP版应用

别说谁变了你拦得住时间么 提交于 2020-04-10 14:48:07
1 安装gearman 2 启动gearman 3 安装php5.6和PHP的gearman扩展 apt-get install php5.6-fpm 安装php扩展用pecl进行安装 apt-get install php5.6-dev php5.6-common pecl install gearman 4 编写应用 work.php <?php //创建一个worker $worker = new GearmanWorker(); //添加一个job服务 $worker ->addServer( '127.0.0.1' , 4730); //注册一个回调函数,用于业务处理 $worker ->addFunction( 'sum' , function ( $job ) { //workload()获取客户端发送来的序列化数据 $data = unserialize( $job ->workload()); return $data [0] + $data [1]; }); //死循环 while (true) { //等待job提交的任务 $ret = $worker ->work(); if ( $worker ->returnCode() != GEARMAN_SUCCESS) { break ; } } 编写client.php <?php //创建一个客户端

Gearman安装及测试

我只是一个虾纸丫 提交于 2020-03-02 19:13:14
一、本地环境安装 服务器环境: Ubuntu 14.04 1. 获取gearmand安装包 > wget https://launchpad.net/gearmand/1.0/1.0.1/+download/gearmand-1.0.1.tar.gz > tar xzvf gearmand-1.0.1.tar.gz 2. 配置 > cd gearmand > ./configure --prefix=/usr/local/gearmand 3. 解决包依赖问题【如果2执行出错,根据错误提示分别安装以下依赖包】 configure: error: could not find boost 错误解决 > apt-get install libboost-all-dev configure: error: could not find gperf 错误解决 > apt-get install gperf configure: error: Unable to find libevent 错误解决 > apt-get install libevent-dev configure: error: Unable to find libuuid 错误解决 > apt-get install libuuid-devel 4. Make > make > make install 5. 启动 >

Gearman, ZF2, Doctrine2, MySQL, SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

大城市里の小女人 提交于 2020-02-28 06:59:53
问题 I use ZF2, Doctrine2, MySQL, Gearman. When working Gearman periodically has an error: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. I tried these steps to fix the problem: 1) I investigated MySQL queries. Queries haven't any problem. It's simple (without subqueries) and fast. For example, this is EXPLAIN of one of queries when MySQL server has gone away. +-------------+-------+-------+-----------------------+-----------------------+---------+-------+------+ | select_type |

Installing gearman PHP extension on Windows using cygwin and pecl

佐手、 提交于 2020-02-06 08:49:30
问题 There is only a handful of threads on installing gearman on Windows, especially the gearman PHP extension. I have not found a solution yet. If anyone found a solution to get gearman PHP extension working on Windows, please comment on this thread. I came across this thread on pecl install gearman . When attempting to install Gearman PHP extension through cygwin using pecl, the installation failed with the following error. $ pecl search gearman Retrieving data...0% Matched packages, channel

How to configure or install GEARMAN in windows OS?

允我心安 提交于 2020-01-20 05:26:05
问题 I want to implement "GEARMAN" in project but I don't know how to install or configure "GEARMAN" in windows OS. Can anyone provide me any link from where I can work with "GEARMAN"? 回答1: Gearman has to be compiled under the cygwin environment : - install cygwin and open the shell; - download and install libevent; - download and install gearman server. Here is a more detailed tutorial : http://www.phpvs.net/2010/11/30/installing-gearman-and-gearmand-on-windows-with-cygwin/. 回答2: Official website

How to configure or install GEARMAN in windows OS?

ぃ、小莉子 提交于 2020-01-20 05:26:00
问题 I want to implement "GEARMAN" in project but I don't know how to install or configure "GEARMAN" in windows OS. Can anyone provide me any link from where I can work with "GEARMAN"? 回答1: Gearman has to be compiled under the cygwin environment : - install cygwin and open the shell; - download and install libevent; - download and install gearman server. Here is a more detailed tutorial : http://www.phpvs.net/2010/11/30/installing-gearman-and-gearmand-on-windows-with-cygwin/. 回答2: Official website

Fork processes indefinetly using gnu-parallel which catch individual exit errors and respawn

谁都会走 提交于 2020-01-15 06:50:33
问题 I guess the title gives you this thought. Another duplicate question Well, let me explain this in detail. Okay, here we go. I am using gearman to handle stack of tasks. I have a gearman client which send this task to workers. To run these task concurrently, there must be more workers to handle a task at a time. Presently, I create workers as per number of cpus. In my case, its 4 . So, 4 processes . ./worker & ./worker & ./worker & ./worker . I have same file running concurrently. But, I don't

Unable to run “gearman” command line tool with gearman 1.1.6

六月ゝ 毕业季﹏ 提交于 2020-01-13 06:53:08
问题 I am trying to run the example on "http://gearman.org/getting_started" on Ubuntu in VirtualBox environment. At first I tried to download an old version 0.16 by using apt-get install gearman-job-server , apt-get install gearman-tools and everything worked well. The server ran in the background, I was able to create 2 workers and verify that I can call them by creating a client. I decided to download and compile the latest version, 1.1.6 . Now, I am trying to do the same thing with the new

Unable to run “gearman” command line tool with gearman 1.1.6

删除回忆录丶 提交于 2020-01-13 06:53:08
问题 I am trying to run the example on "http://gearman.org/getting_started" on Ubuntu in VirtualBox environment. At first I tried to download an old version 0.16 by using apt-get install gearman-job-server , apt-get install gearman-tools and everything worked well. The server ran in the background, I was able to create 2 workers and verify that I can call them by creating a client. I decided to download and compile the latest version, 1.1.6 . Now, I am trying to do the same thing with the new

Requesting client jobs in Gearman bundle in symfony2

若如初见. 提交于 2020-01-06 19:35:37
问题 I'm doing gearman in symfony2 using gearman bundle. I have completed all steps before the last step Requesting client jobs . The doesn't return anything. Page continuously loading.. $gearman = $this->getContainer()->get('gearman'); $gearman->doJob('MmoreramerinoGearmanBundleWorkers~testB'); But when i run the code using callJob instead of doJob , It returned some integer number. It is increase by one for refreshing a page. 来源: https://stackoverflow.com/questions/13193103/requesting-client