edit

Easy Mongrel Clustering with mongrel_cluster

Posted by Bradley Taylor Mon, 24 Apr 2006 17:22:00 GMT

A quick note to announce the release of mongrel_cluster, a gem_plugin for the Mongrel web/application server. This plugin makes it easy to manage multiple Mongrel processes behind a reverse-proxy server and load balancer such as Pound, Balance, Lighttpd, or Apache.

This is the first of many release to support simplified Ruby on Rails application deployment using Rails Machine.

Setup

To get started, install the gem:

sudo gem install mongrel_cluster
Configure the cluster and generate a configuration file. This will run 2 mongrel processes on port 8000 and 8001 using “production” environment :
cd /path/to/my/rad/app
mongrel_rails cluster::configure -p 8000 -e production -a 127.0.0.1

With the configuration file written, you can easily start, stop, and restart the cluster. By default the file is written to config/mongrel_cluster.yml, but you can change the path with the “-C” option.

Start the cluster:
mongrel_rails cluster::start
Restart the cluster:
mongrel_rails cluster::restart
Stop the cluster:
mongrel_rails cluster::stop

Reverse proxy and load balancing

Pound is a reverse proxy, load balancer and HTTPS front-end. It is very easy to configure for use in front of a mongrel cluster.

Install Pound from source or packaging system of choice then edit your configuraton (most likely in /etc/pound/pound.conf).

Sample configuration for use with mongrel_cluster:
User "nobody"
Group "nobody"

ListenHTTP
  Address ip.address.goes.here
  Port 80

  Service
    Backend
      Address 127.0.0.1
      Port 8000
    End
    Backend
      Address 127.0.0.1
      Port 8001
    End
  End 
End
Start Pound:
sudo pound -f /etc/pound/pound.conf

So far in our testing for Rails Machine, this setup works well and its dead simple to setup and maintain. If you don’t want Mongrel to handle static files you could put lighttpd behind Pound and route requests for /images, /stylesheets, /javascript, and other specific paths. This will give you a performance boost on static files, but increase the complexity of your deployment. Your application may not need faster static file serving.

For information on using Mongrel behind Apache, read Scaling with Rails with Apache 2.2, mod_proxy_balancer and Mongrel.

Good luck!

11 comments

Comments

Leave a response

  1. Ezra Zygmuntowicz said 1 day later:
    Hey thanks for this Bradley. Very nice. I am using pen instead of pound as my load balancer but the idea is exactly the same. It works great. Now it will be even easier to manage the mongrels with your plugin.
  2. Bradley said 2 days later:
    Thanks for the tip on Pen. I'll check it out. Glad you find the gem useful.
  3. exchange links said 225 days later:
    exchange links
  4. search engine ranking said 241 days later:
    I’ve use up all my search engine sick days so I’m calling in dead.
  5. reciprocal links said 316 days later:
    The question that you may be asking is How do I get these reciprocal links?
  6. Che Fai said 322 days later:
    Great stuff! And HAML support would be awesome…
  7. lesbian videos said 324 days later:
    The optimizer could be applied to other things such as well! Anyway good position bro, peace:-)
  8. altri eventi said 324 days later:
    isn’t subethaedit already free for personal use? :/ yay for ad revenue
  9. Black Shemale said 328 days later:
    Am I correct in assuming that this only works when the helper is called directly from the template, as opposed to being abstracted away by some custom defined helper?
  10. Anal Sex said 331 days later:
    It’s actually functionally very similar to Ruby blocks, but with an applied assignment (to whatever the function name is). I wonder if Cheetah can do this, or should do this?
  11. Free Shemale Sex said 343 days later:
    The optimizer could be applied to other things such as well! Anyway good position bro, peace:-)

RSS feed for this post

(leave url/email »)

   Comment Markup Help Preview comment

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.