gearman网站
http://gearman.org/getting-started/
下载源代码,并解压
https://launchpad.net/gearmand
tar xzf gearmand-1.1.12.tar.gz
cd gearmand-1.1.12
安装缺少的依赖库
Synaptic 新丽得软件包管理器中安装
- libboost-all-dev
- gperf
- libevent-dev
- uuid-dev
编译并安装
./configure
make
sudo make install
gearmand 在/usr/local/sbin/下
$ sudo /usr/local/sbin/gearmand -d
/usr/local/sbin/gearmand: Could not open log file "/usr/local/var/log/gearmand.log", from "/home/shen/下载/gearmand-1.1.12", switching to stderr. (No such file or directory)
$ sudo mkdir /usr/local/var/log -p
$ sudo /usr/local/sbin/gearmand -d
gearman运行时缺少库文件
$ gearman
gearman: error while loading shared libraries: libgearman.so.8: cannot open shared object file: No such file or directory
需要更新ld路径 sudo ldconfig 生成/etc/ld.so.cache后,再运行 shen@debian:~/下载/gearmand-1.1.12$ gearman
gearman Error in usage(No Functions were provided).
Client mode: gearman [options] [<data>]
Worker mode: gearman -w [options] [<command> [<args> ...]]
Common options to both client and worker modes.
-f <function> - Function name to use for jobs (can give many)
-h <host> - Job server host
-H - Print this help menu
-v - Print diagnostic information to stdout(false)
-p <port> - Job server port
-t <timeout> - Timeout in milliseconds
-i <pidfile> - Create a pidfile for the process
-S - Enable SSL connections
Client options:
-b - Run jobs in the background(false)
-I - Run jobs as high priority
-L - Run jobs as low priority
-n - Run one job per line(false)
-N - Same as -n, but strip off the newline(false)
-P - Prefix all output lines with functions names
-s - Send job without reading from standard input
-u <unique> - Unique key to use for job
Worker options:
-c <count> - Number of jobs for worker to run before exiting
-n - Send data packet for each line(false)
-N - Same as -n, but strip off the newline(false)
-w - Run in worker mode(false)