gearman is a good thing

gearman client --------------> gearman server <------------------------gearman worker

clients are requesting to handler something,

gearman server is delivering jobs

gearman workers get some jobs and finish.

So different programming languages can work together.

Now we need to plant gearman persistent queues on postgresql.

So.

Now

Persistent Queue

  • Tools: gearman, postgresql, python, django model and other 3rd party libs
  • bash sudo pip install gearman && sudo apt-get install gearman -y
  • Database settings: [username] = gearman, [password] = 'gearman_password_123', [database] = 'chatservice', [port]=5432, [table_name] = queue123
  • sudo su - postgres
    # Then,
    psql
    # Then
    CREATE DATABASE gearman;
    CREATE USER gearman with password gearman_password_123;
    GRANT ALL PRIVILEGES ON DATABASE gearman to gearman;

    On a server:

There are two ways to make gearman work with Postgresql server

FIRST WAY

  • Postgresql

To get Postgresql working you need to use the -q Postgeres command line option.

Below is a command line to get persistent queues working with Postgresql. This command line was run on Ubuntu 12.04 server, Postgresql version 9.1, and Gearman v 0.27.

gearmand -L 127.0.0.1 –libpq-conninfo 'hostaddr=127.0.0.1 port=5432 dbname=gearman user=gearman password=gearman_password_123' –libpq-table=gearmanqueue1 –verbose DEBUG -q Postgres
  • Also note: gearmand will create the table if it does not already exist. In the case above, it will create a table named gearmanqueue1
  • You can see /var/log/gearman-job-server/gearman.log for log if error or somehow.

SECOND WAY

  • Edit the file /etc/default/gearman_job_server and make sure it would look like this:
export PGHOST=127.0.0.1
export PGPORT=
export PGUSER=gearman
export PGPASSWORD=gearman_password_123
export PGDATABASE=gearman
PARAMS="-q Postgres --libpq-table=gearmanqueue1 --verbose DEBUG"
  • Then try to start the service bash sudo service gearman-job-server start, gearman will auto-matically create a table 'gearmanqueue1' there.
The second way is recommended.

最新文章

  1. Java中MyEclipse快捷键整理
  2. TOJ2647
  3. Swing How to make dialogues
  4. SharePoint 2013 手动删除爬网项目
  5. 五大Android布局方式浅析
  6. .Net字符串驻留池
  7. 用python3.x与mysql数据库构建简单的爬虫系统(转)
  8. windbg工具安装配置及dump抓取
  9. CUDA5.5 的环境变量设置
  10. MongoDB中级----&gt;关联多表查询
  11. 《程序员的自我修养》读书笔记——系统调用、API
  12. 如何在EXCEL中找出第一列中不包含的第二列数据
  13. 据说是Flord算法
  14. java 定时器中任务的启动、停止、再启动
  15. Oracle中dual表的用途介绍-转
  16. 无法启动此程序,因为计算机中丢失api-ms-win-crt-runtime-|1-1-0.dll
  17. mysql的存储过程与事务入门
  18. J2SE 8的泛型
  19. eclipse安装Android插件
  20. 第三次c++作业

热门文章

  1. 枚举 UIButton补充
  2. PKU 1276 Cash Machine
  3. lib库实现loadrunner驱动mysql性能测试
  4. Spring IOC之Bean 概述
  5. C#发送邮件三种方法(Localhost,SMTP,SSL-SMTP)
  6. 【转】Android官方下拉刷新控件 SwipeRefreshLayout
  7. JAVA开发语言基础
  8. RequireJS 入门指南
  9. springmvc3.1.1+hibernate4
  10. keepalive学习