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++语言开 ...
随机推荐
- [ASP.NET MVC]如何定制Numeric属性/字段验证消息
原文:[ASP.NET MVC]如何定制Numeric属性/字段验证消息 对于一个Numeric属性/字段,ASP.NET MVC会自动进行数据类型的验证(客户端验证),以确保输入的是一个有效的数字, ...
- 2014阿里实习生面试题——mysql如何实现的索引
这是2014北京站的两副面孔阿里实习生问题扯在一起: 在MySQL中.索引属于存储引擎级别的概念,不同存储引擎对索引的实现方式是不同的,比方MyISAM和InnoDB存储引擎. MyISAM索引实现: ...
- Critical thinking and Thoughtful writing
Critical thinkers are able to : Articulate their ideas clearly and persuasively in writing Understan ...
- css mainDiv和popbox居中
<style> .beCenter { width:460px; height:212px; background:#ccc; ...
- Win8.1系统下配置搭建IIS8.5+PHP5.5.4运行环境
原文 Win8.1系统下配置搭建IIS8.5+PHP5.5.4运行环境 很多人喜欢用linux搭建php网页语言运行环境,但由于linux高度自定义化,经常需要root运行命令,略显高端,相对应的微软 ...
- CSS学习笔记:transition
CSS3的transition允许CSS的属性值在一定的时间区间内平滑地过渡.这种效果可以在鼠标单击.获得焦点.被点击或对元素任何改变中触发,并圆滑地以动画效果改变CSS的属性值. 1.transit ...
- 多数据库下activiti的流程定义缓存问题
我们使用activiti(5.14版本号)作为流程引擎,今天在产品中发现一个问题,某流程的审批记录中, 活动实例表中记录的活动名称(ACT_HI_ACTINST表的ACT_NAME)居然是该流程中不存 ...
- leetcode第四题--Add Two Numbers
Problem: You are given two linked lists representing two non-negative numbers. The digits are stored ...
- Linux下查看MySQL的安装路径
Linux下查看mysql.apache是否安装,并卸载. 指令 ps -ef|grep mysql 得出结果 root ? :: /bin/sh /usr/ ...
- ASP.Net中应用百度编辑器(UEditor)上传图片和上传附件失败-解决方案
第一步: 第二步: 第三步: 第四步: