知乎專欄 | 多維度架構 | 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者” |
http://gearman.org/
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm yum install gearmand -y chkconfig gearmand on service gearmand start
配置啟動參數
cat >> /etc/sysconfig/gearmand <<EOF OPTIONS="--log-file=/var/log/gearman.log --threads=512" EOF
$ apt-cache search gearman | grep gearman drizzle-plugin-gearman-udf - Gearman User Defined Functions for Drizzle drizzle-plugin-logging-gearman - Gearman Logging for Drizzle gearman - Distributed job queue gearman-job-server - Job server for the Gearman distributed job queue gearman-server - Gearman distributed job server and Perl interface gearman-tools - Tools for the Gearman distributed job queue libgearman-client-async-perl - asynchronous client for the Gearman distributed job system libgearman-client-perl - client for the Gearman distributed job system libgearman-dbg - Debug symbols for the Gearman Client Library libgearman-dev - Development files for the Gearman Library libgearman-doc - API Documentation for the Gearman Library libgearman6 - Library providing Gearman client and worker functions mod-gearman-doc - Documentation and examples for Mod-Gearman mod-gearman-module - Nagios/Icinga event broker module for Mod-Gearman mod-gearman-tools - Tools for mod-gearman mod-gearman-worker - Worker agent for Mod-Gearman python-gearman - Python interface to the Gearman system python-gearman.libgearman - Python wrapper of libgearman python3-gearman.libgearman - Python 3 wrapper of libgearman
控制台 A
gearman -w -f wc -- wc -l
控制台 B
#wc -l < /etc/passwd 30 # wc -l < /etc/passwd 30
停止 gearman 進程再試
# /etc/init.d/gearmand stop Stopping gearmand: [ OK ] [root@haproxy ~]# gearman -f wc < /etc/passwd gearman:gearman_client_run_tasks:gearman_connection_flush:could not connect
壓力測試
find / -type f | awk '{ print "gearman -f wc < " $1 }' | bash
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm yum install libgearman-devel pecl install channel://pecl.php.net/gearman-0.8.3 cat >> /srv/php/etc/conf.d/gearman.ini <<EOF extension=gearman.so EOF
測試安裝
# php -r 'printf("%s \r\n", gearman_version());' 0.14