Skip to content
calavera edited this page Sep 13, 2010 · 2 revisions

Configuration options

To configure the AJP connector we have to enable it with the option —ajp in the command line or adding it in the configuration file.

This option can take a number as value to specify the port to run on, for instance:


jruby -S trinidad --ajp 8099

or it can take a hash with several configuration options if we specify it in the configuration file, for instance:


---
  :ajp:
    :port: 8099
    :allowTrace: true

All the available options are listed here in the Tomcat’s reference page

Configuring Apache load balancing with Trinidad

First we have to ensure all the apache modules that we need are loaded:


  $ sudo a2enmod proxy_ajp proxy_balancer

After that, we have to configure our virtual host to proxy the connections through ajp, this is an actually basic configuration, there are a lot of resources about mod_proxy_balancer on internet:


<Proxy balancer://trini>
  BalancerMember ajp://127.0.0.1:8009
  BalancerMember ajp://127.0.0.1:8099
</Proxy>

ProxyPass / balancer://trini/

Notice that I’m using my development machine and that’s why the two balancer members have the same ip but different port.

Finally, we have to run two different instances of Trinidad with the ajp option enabled, with the ports we specified in the balancer configuration (8009 is the default one), and different http ports due to I’m running it in my machine:



$ trinidad --port 3001 --ajp
$ trinidad --port 3002 --ajp 8099