Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Changed convention of tomcat letters to numbers to match port numbers used.

...

Code Block
languagebash
# Configure environment slash... ps=\ on NT and / on UNIX
ps=/

# Define workers using ajp13
worker.list=tomcat_a0_worker

# Set properties for worker
worker.tomcat_a0_worker.type=ajp13
worker.tomcat_a0_worker.host=localhost
worker.tomcat_a0_worker.port=8009
worker.tomcat_a0_worker.lbfactor=1

In the above case are creating a worker called tomcat_a0_worker for a web application to connect to TomcatA which will run in the www.krypton.com virtualhost. Notice the host=localhost line in yellow. This should point to the server that Tomcat is running on. In this case, we are have Apache and Tomcat on the same server so we use localhost.

...

Code Block
languagebash
# Define workers using ajp13
worker.list=loadbalancer

# Set properties for worker
worker.tomcat_a0_worker.type=ajp13
worker.tomcat_a0_worker.host=localhost
worker.tomcat_a0_worker.port=8009
worker.tomcat_a0_worker.lbfactor=1

# Set properties for worker
worker.tomcat_b1_worker.type=ajp13
worker.tomcat_b1_worker.host=localhost
worker.tomcat_b1_worker.port=8109
worker.tomcat_b1_worker.lbfactor=1

# Set up load balancer using ajp13 workers
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=tomcat_a0_worker,tomcat_b1_worker

The load balancing uses weighted round-robin with sticky sessions. The lower the lbfactor number the less weight and as such the less work done by the worker. In our example, since both TomcatA and TomcatB have a factor of 1 the load balance is split about 50/50.

...

Code Block
languagexml
JkMount /examples/* tomcat_a0_worker
JkMount /examples tomcat_a0_worker

Note that examples is written twice, the reason for this is so that it will recognize the command the same if the person enters /examples or /examples/etc

Note

The above example uses tomcat_a0_worker for the name of the worker. This name depends on what value was used in workers.properties file for worker.list. In this article we had two other examples,
ajp13_worker (if you went with the default generated workers.properties file) or loadbalancer (if you opted to follow the load balancer example).

...