Академический Документы
Профессиональный Документы
Культура Документы
http://blogs.oracle.com/dadelhardt/entry/loadbalancing_with_mod_jk_and...
LoadModule jk_module modules/mod_jk.so JkWorkersFile path_to_your_config/conf/workers.properties JkLogFile path_to_your_log_dir/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat "%w %V %T" #Mount your webapps eg WebApplication1 using JkMount JkMount /WebApplication1/\* loadbalancer
Create a worker.properties File for the mod_jk connector. In the example shown below a load balancing worker for two local GlassFish instances (listening on jk port 8009/8010) is provided.
worker.list=loadbalancer worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=1 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=300 worker.worker2.type=ajp13 worker.worker2.host=localhost worker.worker2.port=8010 worker.worker2.lbfactor=1 worker.worker2.socket_keepalive=1
1 de 2
http://blogs.oracle.com/dadelhardt/entry/loadbalancing_with_mod_jk_and...
Enable the jk connector in each GlassFish instance by adding a JVM Option with asadmin. If your instances run on the same box you have to choose different JK ports. The ports must also match your worker.workerX.port definitions in your worker.properties files.
$GLASSFISH_HOME/bin/asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009
Copy the following jar archives to your GlassFish Installations lib directory ($GLASSFISH_HOME/lib): tomcat-ajp.jar (from Tomcat 5.5.16 /server/lib dir), commons-logging.jar and commons-modeler.jar. Next restart your apache httpd and your glassfish instances. If JK connector was enabled successfully in glassfish you should see a log entry in your server log as for example:
[#|2006-12-01T11:33:14.667+0100|INFO|sun-appserver-pe9.0| org.apache.jk.common.ChannelSocket|_ThreadID=11;_ThreadName=Thread-5;|JK: ajp13 listening on /0.0.0.0:8009|#]
Now all web applications that are deployed to your GlassFish instances and that are mounted in your httpd.conf through JkMount commands should be loadbalanced equally. More advanced jk configuration properties may be found in the Tomcat connectors documentation Category: Glassfish Tags: glassfish
2 de 2