安裝編譯相關套件:
# apt-get build-dep gearman-job-server
# apt-get install gperf libmysqlclient-dev libmysqld-dev
下載 Gearman :
https://launchpad.net/gearmand
$ wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz
$ tar zxf gearmand-1.1.12.tar.gz
$ cd gearmand-1.1.12
$ ./configure --prefix=/opt/gearman
...
...
...
* CPP Flags: -fvisibility=hidden
* LIBS:
* LDFLAGS Flags:
* Assertions enabled: no
* Debug enabled: no
* Warnings as failure: no
* Building with libsqlite3 yes
* Building with libdrizzle yes
* Building with libmemcached yes
* Building with libpq yes
* Building with tokyocabinet no
* Building with libmysql yes
* SSL enabled: no
* cyassl found: no
* openssl found: yes
* make -j: 2
* VCS checkout: no
* sphinx-build: :
$ make
# make install
新增資料庫:
CREATE DATABASE gearman; CREATE TABLE gearman_queue ( unique_key VARCHAR(255), function_name VARCHAR(255), priority INT, data LONGBLOB, when_to_run BIGINT, unique key (unique_key, function_name) );
啓動:
# /opt/gearman/sbin/gearmand --log-file=/var/log/gearmand.log --queue-type=MySQL --mysql-host=127.0.0.1 --mysql-user=gearman --mysql-password=gearman --mysql-db=gearman --mysql-table=gearman_queue --mysql-port=3306
References :
【CentOS】Gearman のジョブを MySQL に保存する - pospomeのプログラミング日記
生活在別處 : Gearman 安装及常见问题
舊:
Using Persistent Storage with Gearman | LornaJane
沒有留言:
張貼留言