Beanstalk – Part 1
As I mentioned in my previous post, I will write some articles about Beanstalk queuing server to help share what I find out about it. In this post I will cover installing and running Beanstalk.
One point worth mentioning is that Beanstalk is an in-memory based queuing system. What this means that everything is stored in the memory. So if the power goes out, the machine hangs, or beanstalk terminates for any reason, any and all jobs in the queue will be lost. Of course this behavior can be changed with startup options (explained below).
Beanstalk requires having libevent installed in order for it to work. So lets start by installing libevent. In a terminal on your linux or mac machines run the following commands:
wget http://monkey.org/~provos/libevent-1.4.12-stable.tar.gz
tar -xzf libevent-1.4.12-stable.tar.gz
cd libevent-1.4.12-stable
./configure
make
make install
Now that you have libevent installed, we need to install beanstalk:
wget http://xph.us/dist/beanstalkd/beanstalkd-1.4.2.tar.gz
tar -xzf beanstalkd-1.4.2.tar.gz
cd beanstalkd-1.4.2
./configure
make
make install
That wasn’t too hard
To run beanstalk, all you have to do now is run the command “beanstalkd”. However, there are some interesting options you can pass to the command:
- -d to detach the process, or to run it as a daemon. The process will be removed from the foreground and you will get your terminal back, but beanstalk will be still working in the background.
- -b as mentioned above, beanstalk is a memory-based queue. To let your jobs persist power outages or server crashes the -b option would store any job beanstalk receives into a binary log file. If beanstalk terminates for any reason, you can start it again with the same -b option, and your jobs will be restored.
- -s BYTES Limit binary log file size to BYTES maximum. Default 10485760
- -l specify the address to listen to. Default 0.0.0.0
- -p specify the port to listen to. Default 11300
- -u which user to run as
- -z BYTES limit job size to BYTES maximum. Default 65535
I am running the server with the following command: beanstalkd -d -l 127.0.0.1 -p 11300 -b PATH_TO_BIN_DIR
Now we have a running beanstalkd server. In my next article, I’ll talk about how to use a client to connect to the running beanstalkd instance, and interact with it.
on November 3, 2009 on 5:46 am
[...] in Uncategorized by f10i on the November 3, 2009 Tags: beanstalk, client, ruby Now that we have setup the beanstalk server, it’s time to start using it. First thing we need to do is to install a beanstalk client. [...]
on May 17, 2010 on 2:57 am
Keep up the good work, bookmarked and referred some mates.