gearman perl 测试经验

 时间:2024-10-13 21:54:11

1、安装wget -c http://launchpadlibrarian.net/51244438/gearmand-0.14.tar.gztar zxvf gearmand-0.14.tar.gzcd gearmand-0.14./configuremake && make installcpan -i Gearman::Servercpan -i Gearman::Workercpan -i Gearman::Client

2、启动gearmandgearmand -d -L 10.16.27.32 -p 7003

3、书写worker.pl#!/usr/bin/perl -wuse Gearman::Worker;my $worker = Gearman::Worker->new;$worker->job_servers('10.16.27.32:7003');$worker->register_function( watchtime => \&watchtime );$worker->work while 1;sub watchtime { my $job= shift;return "arg=".$job->arg;}perl worker.pl

4、书写client.pl#!/usr/bin/perl -wuse Gearman::Client;use POSIX qw(strftim髫潋啜缅e);my $client = Gearman::Client->new;$client->job_servers('10.16.27.32:7003');my $log=$client->do_task('watchtime',"aaaa");printlog,"\n";$log=$client−>dotask(′watchtime′,"aaaabbb");printlog,"\n";执行client.pl,可看到返回数据

  • Gearman是什么?
  • windows 安装 perl 教程
  • PHP利用Gearman来处理并行多进程问题
  • Perl列表和数组常用的操作符
  • Perl的标量运算操作符
  • 热门搜索
    书签怎么做 脸上长痘痘怎么调理 猫肉为什么不能吃 天安门怎么画 个人所得税怎么退 唳怎么读音 春天用英语怎么说 厨师证怎么考 鲧怎么读 海水为什么是蓝色的