php gearman集群 安装与运用
来源:互联网 发布:mac utorrent 打不开 编辑:程序博客网 时间:2024/04/29 08:36
做了german集群,所以worker.php要复制两份,当然german都要安装两份。
german是自动根据机器任务程度自动分发的,不需要做任何关于它的配置。
Linux上安装:
202 yum install -y boost-devel gperf libevent-devel libuuid-devel 203 wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz 204 LS 205 ls 206 tar xf gearmand-1.1.12.tar.gz 207 cd gearmand-1.1.12 208 ls 209 ./configure 210 make && make install 211 /sbin/ldconfig 212 cd /opt 213 wget http://pecl.php.net/get/gearman-1.1.2.tgz 214 tar xf gearman-1.1.2.tgz 215 ls 216 cd gearman-1.1.2 217 ls 218 /usr/local/php/bin/phpize 219 ./configure --with-php-config=/usr/local/php/bin/php-config --with-gearman 220 make && make install 221 make test 222 vi /home/wwwroot/bulutu.a.com/test.php 223 vi /usr/local/php/etc/php.ini 224 /etc/init.d/php-fpm restart 225 /usr/local/sbin/gearman -p 4730 -u root -d 226 /usr/local/sbin/gearmand -p 4730 -u root -d 227 mkdir -p /usr/local/var/log 228 /usr/local/sbin/gearmand -p 4730 -u root -d 229 ls /home/wwwroot/bulutu.a.com/ 230 vi /home/wwwroot/bulutu.a.com/worker.php 231 cd /home/wwwroot/bulutu.a.com/ 232 php worker.php &
worker.php 源码:
<?php$worker = new GearmanWorker();$worker->addServer("192.168.1.11",4730);$worker->addServer("192.168.1.12",4730);$worker->addFunction("title","title_function");while($worker->work());
//不同机器返回不同以作区别function title_function($job){ return ucwords(strtolower($job->workload()));//192.168.1.11
retrun '12321321';//192.168.1.12
}?>
client.php 源码:
<?php$client = new GearmanClient();$makr = 1;if(!$client->addServer("192.168.1.11",4730)){echo 'hh';exit;}if(!$client->addServer("192.168.1.12",4730)){echo 'dd';exit;}print $client->do("title","AIL THE World's a sTagE");print "\n";?>
参考资料:http://learnbank.blog.163.com/blog/static/12869923720126122212562/
0 0
- php gearman集群 安装与运用
- php gearman集群 安装与运用
- gearman-安装php扩展
- gearman安装 以及php添加gearman拓展
- Centos下 Gearman安装与php扩展安装
- 安装Gearman及其PHP扩展
- gearman+php 安装以及使用
- ubuntu 安装Gearman php扩展
- 分布式计算框架Gearman和PHP Gearman扩展安装流程
- gearman的YUM安装及PHP应用
- CentOS 安装Gearman及其PHP扩展
- ubuntu12.04 安装Gearman及其php扩展
- centos6.5 安装gearman和php扩展
- Gearman 异步任务软件安装与实例
- gearman的安装与使用示例
- Gearman的源码编译与安装
- 安装 Gearman
- Gearman安装
- Tango 开发指南(10) — 深度感知原理
- Java 连接数据库(SQL Server 2008)
- 维护篇 11. 恢复出厂设置 ❀ 飞塔 (Fortinet) 防火墙
- easyui 格式化日期以及国际化的引用
- node不是内部或外部命令
- php gearman集群 安装与运用
- HDU 2544 最短路
- python-cookbook学习笔记三
- vmware 上网络桥接模式不能上网。。 解决方案
- 深度学习物体检测(一)——RCNN
- ajax调用实例
- 闲谈自定义控件源码-view 测量
- 移植QT5.6到嵌入式开发板(史上最详细的QT移植教程)
- Shell编程详解