# Install Beanstalkd in Ubuntu14

### Beanstalkd ‘s core concept of design

• job：A task that needs to be handled asynchronously is the basic unit in Beanstalkd and needs to be placed in a tube。
• tube：A task queue, used to store a uniform type of job, is an object of producer and consumer operations。
• producer：Job producer, put a job by put command into a tube。
• consumer：Job consumers, through the reserve/ release/ bury/ delete command to get the job or change the status of the job。

### Job ‘s status

• DELAYED : delay the implementation of the task, when the consumer to deal with the task, you can use the message back to the DELAYED queue delayed execution;
• RESERVED : Has been consumer acquisition, the ongoing task. Beanstalkd is responsible for checking whether the task is completed within the time-to-run (TTR)
• BURIED : Reserved tasks: The task will not be executed, it will not disappear unless someone “kicked” it back in the queue;
• DELETED : The message is completely deleted. Beanstalkd no longer maintain these messages.

### Install Beanstalkd

Auto start

Pay attention to this place "-b /var/lib/beanstalkd" which can recovery your queue data after machine shutdown suddenly.
Beanstalkd will find its binlog files which is 10M max size default under this directory

### Using Beanstalkd php client

I’m using the php client pda/pheanstalk
It needs php5.3+