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
There is ways to make Gearman work with Postgresql Serverfirst
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