Welcome Guest | Login

Apache problem with BalancerMember and/or Forbidden error

I'm trying to set up Apache to work with a mongrel cluster. I'm following the instructions at http://mongrel.rubyforge.org/wiki/Apache

In the current state, I'm getting a "Forbidden" error on every URL. When I restart httpd, I get this:

Invalid command 'BalancerMember', perhaps mis-spelled or defined by a module not included in the server configuration

which is referencing a file in /etc/httpd/conf.d containing:

 <Proxy balancer://mongrel_cluster>
   BalancerMember http://127.0.0.1:8001
   BalancerMember http://127.0.0.1:8002
   BalancerMember http://127.0.0.1:8003
   BalancerMember http://127.0.0.1:8004
 </Proxy>


httpd.conf contains:

LoadModule proxy_module       modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module  modules/mod_proxy_http.so

So it seems to me the module should be getting loaded. Additionally:

apachectl -t -D DUMP_MODULES
Loaded Modules:
core_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
include_module (static)
filter_module (static)
log_config_module (static)
env_module (static)
mime_magic_module (static)
usertrack_module (static)
setenvif_module (static)
ssl_module (static)
mpm_prefork_module (static)
http_module (static)
mime_module (static)
dav_module (static)
status_module (static)
autoindex_module (static)
asis_module (static)
info_module (static)
cgi_module (static)
dav_fs_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
userdir_module (static)
alias_module (static)
rewrite_module (static)
so_module (static)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_http_module (shared)
headers_module (shared)
dav_svn_module (shared)
authz_svn_module (shared)
Syntax OK

2008-09-02 08:33 PM

I've copied the binary /usr/local/apache/bin/httpd to /usr/sbin/httpd and /bin/httpd and also made some changes in the http startup script. Also I've added the necessary vhost entries in /usr/local/apache/conf/httpd.conf file and started apache.. I'm able to access your site using the IP assigned to your VPS account and is on Mongrel now.

2008-09-02 10:19 PM

Thanks for looking into this. Can you describe the purpose of the changes you made so that I can learn what I was doing wrong?

Are you sure that Apache is properly using the Mongrel cluster? I started up the  processes on the four ports. I then watched "top" while accessing the site and it was only using the one process. Then I tried shutting down that process to see if the others would take over, and they didn't; the site went to serving up 503s.

2008-09-02 10:54 PM

The path to the exact apache configuration is /usr/local/apache . When I started apache using /etc/init.d/httpd script I could see that the apache configuration path taken was /etc/httpd/. I've made the changes in the start up script so that the path taken is /usr/local/apache  and also copied the correct binary as mentioned earlier.

Regarding the the mongrel cluster issue, I've started mongrel cluster of 4 instances and I could see all the processes on executing top command. Also the load balancing is working fine. I've tested it by killing one process and the domain works without any issue.

2008-09-03 01:23 AM

Yes, it does appear to be load balancing correctly currently. I think I had made a mistake in the commands I was issuing (I accidentally incremented the IP number as well as the port so 8002-8004 were actually on different IPs). The corrected version is below:
mongrel_rails start -d -e production -p 8001 -a 127.0.0.1 -P tmp/pids/mongrel.8001.pid -l log/mongrel.8001.pid
mongrel_rails start -d -e production -p 8002 -a 127.0.0.1 -P tmp/pids/mongrel.8002.pid -l log/mongrel.8002.pid
mongrel_rails start -d -e production -p 8003 -a 127.0.0.1 -P tmp/pids/mongrel.8003.pid -l log/mongrel.8003.pid
mongrel_rails start -d -e production -p 8004 -a 127.0.0.1 -P tmp/pids/mongrel.8004.pid -l log/mongrel.8004.pid
Are these the same commands you were using?

2008-09-03 07:03 PM

I've already configured mongrel cluster on the server and you can manage it by issuing the following commands.

------------------------
mongrel_rails cluster::start ->start the cluster
mongrel_rails cluster::stop ->stop the cluster
mongrel_rails cluster::restart ->restart the cluster
------------------------

The command you've provided is for starting a single instance of mongrel and not for starting clusters.

2008-09-03 09:40 PM

Thanks for your help.

2008-09-03 09:43 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.