天天看點

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

運作結果