gearman with postgresql as persistent Queuing
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.logfor log if error or somehow.
SECOND WAY
- Edit the file
/etc/default/gearman_job_serverand 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.
gearman with postgresql as persistent Queuing的更多相关文章
- gearman 简单试用
服务启动 使用yum 的安装包 安装server yum install -y gearmand 启动 systemctl restart gearmand 启动worker gearman ...
- gearman mysql持久化
gearman 创建Mysql持久化队列的方式如下: 启动gearman,命令如下: gearmand命令: -b, –backlog=BACKLOG 连接请求队列的最大值 -d, –daemon D ...
- PostgreSQL的OGG -- bucardo
bucardo是PostgreSQL数据库中实现双向同步的软件,可以实现PostgreSQL数据库的双master的方案,不过bucardo中的同步都是异步的,它是通过触发器记录变化,程序是perl写 ...
- Streaming replication slots in PostgreSQL 9.4
Streaming replication slots are a pending feature in PostgreSQL 9.4, as part of the logical changese ...
- gearman安装及初次使用
官网: http://gearman.org/ 一篇文章: 利用Gearman实现异步任务处理 一.问题分析 问题:在性能测试过程中,发现用户管理平台在进行图片上传时,性能不佳. 分析:经过代码分析 ...
- psycopg2.pool – Connections pooling / psycopg2.pool – 连接池 / postgresql 连接池
创建新的PostgreSQL连接可以是一个昂贵的操作.这个模块提供了一些纯Python类直接在客户端应用程序实现简单的连接池. class psycopg2.pool.AbstractCon ...
- 对PostgreSQL xmin的深入学习
当PostgreSQL需要insert 一条记录的时候,它会把记录头放入xmin,xmax等字段. xmin的值,就是当前的Transaction的TransactionId.这是为了满足MVCC的需 ...
- PHP+lghttpd + postgresql 环境搭建
PHP+lghttpd + postgresql 环境搭建 Linux 下PHP环境搭建 安装环境:PHP+lghttpd + postgresql 1:yum install lighttpd 红旗 ...
- gearman学习笔记1
1.简介 gearman是一个分布式开发框架,适合处理一些必须处理但是不影响主流程的操作,比如保存日志.发送邮件.缩略图片等.最早是基于perl语言的,2008年发布的时候改为C++语言开 ...
随机推荐
- HDU 4791 & ZOJ 3726 Alice's Print Service (数学 打表)
题目链接: HDU:http://acm.hdu.edu.cn/showproblem.php?pid=4791 ZJU:http://acm.zju.edu.cn/onlinejudge/showP ...
- 基于HTTP/2和protobuf的RPC框架:GRPC
谷歌发布的首款基于HTTP/2和protobuf的RPC框架:GRPC Google 刚刚开源了grpc, 一个基于HTTP2 和 Protobuf 的高性能.开源.通用的RPC框架.Protobu ...
- Android EventBus现实 听说你out该
转载请注明出处:http://blog.csdn.net/lmj623565791/article/details/40794879.本文出自:[张鸿洋的博客] 1.概述 近期大家面试说常常被问到Ev ...
- C#映射网络驱动器
using System.Runtime.InteropServices; [StructLayout(LayoutKind.Sequential)] public class NetResource ...
- Oralce 处理字符串函数
原文:Oralce 处理字符串函数 平常我们用Oracle主要有两种字符串类型1.char始终为固定的长度,如果设置了长度小于char列的值,则Oracle会自动用空格填充的.当比较char时,Ora ...
- javascript 控制台输出 图片 console.log 真强大 真佩服你们的创造力
无意中,在百度知道页面发现了这货.居然能输出图片到控制台. 完全颠覆自己的三观,果断查阅其输出方法.后得知,原来如此. 曾经做过的项目中,同事把控制台做成一个网页形式方便远程控制和远程调用.没想到过这 ...
- Phpstorm配置phpunit对php进行单元测试
在 phpstorm 中配置 php 项目的单元测试,项目使用 Composer 进行管理,为了避免在项目中直接引入 phpunit 相关代码包,使项目的 vendor 目录变得臃肿,这里采用全局安装 ...
- UpdateModel方法
WebForm 对 MVC 说:能否借你的UpdateModel方法来用用? 背景 ASP.NET MVC的Controller有个很不错的方法:UpdataModel (相对应的还有TryUpdat ...
- 熔断器C#实现
关键词1:保险丝.电闸跳闸.输入密码错误3次则在指定的时间之内禁止登录 关键词2:保护性架构.防御性代码.软件可靠性 实现:https://github.com/fecktty/Circuit_Bre ...
- 读书笔记—CLR via C#线程27章节
前言 这本书这几年零零散散读过两三遍了,作为经典书籍,应该重复读反复读,既然我现在开始写博了,我也准备把以前觉得经典的好书重读细读一遍,并且将笔记整理到博客中,好记性不如烂笔头,同时也在写的过程中也可 ...