Gearman with PostgreSQL as persistent Queuing

Source: Internet
Author: User
Tags postgresql version

Gearman is a good thing

Gearman client--------------> Gearman Server <------------------------Gearman worker

Clients is 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, [Ta Ble_name] = queue123
    • sudo su - postgres# Then, psql# thencreate DATABASE Gearman; CREATE USER gearman with password gearman_password_123; GRANT all privileges on the DATABASE gearman to Gearman;

      On a server:

There is ways to make Gearman work with Postgresql Serverfirst
    • Postgresql

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

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

127.0. 0.1 ' 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 would create the table if it does not already exist. In the case above, it'll create a table named Gearmanqueue1
    • You can see for /var/log/gearman-job-server/gearman.log log if error or somehow.
SECOND
    • Edit the file and make /etc/default/gearman_job_server sure it would look like this:
Export pghost=127.0. 0.1 export PGPORT=5432export Pguser=gearmanexport Pgpassword=Gearman_password _123export pgdatabase=gearmanparams="-Q Postgres--libpq-table=gearmanqueue1-- Verbose DEBUG"

    • Then try to start the service bash sudo service gearman-job-server start , Gearman would auto-matically create a table ' gearmanqueue1 ' there.
The second is recommended.

Gearman with PostgreSQL as persistent Queuing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.