天天看点

Gearman + PHP 实现分布式对象调用

中国广东省深圳市龙华新区民治街道溪山美地

518131

+86 13113668890

+86 755 29812080

$id$

版权 © 2011, 2012, 2013 http://netkiller.github.io

$date$

摘要

在群里看到有网友问,idc的服务器是否需要开启防火墙,我意识到应该写一篇关于idc安全的文章。

<a></a>

我的系列文档

<a href="http://netkiller.github.io/architect/index.html" target="_top">netkiller architect 手札</a>

<a href="http://netkiller.github.io/developer/index.html" target="_top">netkiller developer 手札</a>

<a href="http://netkiller.github.io/php/index.html" target="_top">netkiller php 手札</a>

<a href="http://netkiller.github.io/python/index.html" target="_top">netkiller python 手札</a>

<a href="http://netkiller.github.io/testing/index.html" target="_top">netkiller testing 手札</a>

<a href="http://netkiller.github.io/cryptography/index.html" target="_top">netkiller cryptography 手札</a>

<a href="http://netkiller.github.io/linux/index.html" target="_top">netkiller linux 手札</a>

<a href="http://netkiller.github.io/centos/index.html" target="_top">netkiller centos 手札</a>

<a href="http://netkiller.github.io/freebsd/index.html" target="_top">netkiller freebsd 手札</a>

<a href="http://netkiller.github.io/security/index.html" target="_top">netkiller security 手札</a>

<a href="http://netkiller.github.io/version/index.html" target="_top">netkiller version 手札</a>

<a href="http://netkiller.github.io/www/index.html" target="_top">netkiller web 手札</a>

<a href="http://netkiller.github.io/monitoring/index.html" target="_top">netkiller monitoring 手札</a>

<a href="http://netkiller.github.io/storage/index.html" target="_top">netkiller storage 手札</a>

<a href="http://netkiller.github.io/mail/index.html" target="_top">netkiller mail 手札</a>

<a href="http://netkiller.github.io/shell/index.html" target="_top">netkiller shell 手札</a>

<a href="http://netkiller.github.io/network/index.html" target="_top">netkiller network 手札</a>

<a href="http://netkiller.github.io/database/index.html" target="_top">netkiller database 手札</a>

<a href="http://netkiller.github.io/postgresql/index.html" target="_top">netkiller postgresql 手札</a>

<a href="http://netkiller.github.io/mysql/index.html" target="_top">netkiller mysql 手札</a>

<a href="http://netkiller.github.io/nosql/index.html" target="_top">netkiller nosql 手札</a>

<a href="http://netkiller.github.io/ldap/index.html" target="_top">netkiller ldap 手札</a>

<a href="http://netkiller.github.io/cisco/index.html" target="_top">netkiller cisco ios 手札</a>

<a href="http://netkiller.github.io/h3c/index.html" target="_top">netkiller h3c 手札</a>

<a href="http://netkiller.github.io/multimedia/index.html" target="_top">netkiller multimedia 手札</a>

<a href="http://netkiller.github.io/docbook/index.html" target="_top">netkiller docbook 手札</a>

<a href="http://netkiller.github.io/oss/index.html" target="_top">netkiller 开源软件 手札</a>

目录

文本格式回复

php扩展安装

确认模块是否安装,同时检查gearman扩展的版本。

测试脚本 server.php

测试脚本 client.php

我用'o' 表示与上次备份中有差异的部分。

gearman 向functon 传递参数只能通过$job-&gt;workload(), 而 $job-&gt;workload() 只能传递字符串。

如果托传递多个参数,需要将参数序列化后传递

返回值也一样,一个字符串可以直接返回,如果返回数字类型是不允许的,需要序列化处理

例 1. 多参数传递与返回值实例

server

client

运行结果