# Load mod_jk module # Specify the filename of the mod_jk lib LoadModule jk_module modules/mod_jk.so # Where to find workers.properties JkWorkersFile conf/workers.properties # Where to put jk logs JkLogFile logs/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" # JkOptions indicates to send SSK KEY SIZE JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat JkRequestLogFormat "%w %V %T" # Mount your applications JkMount /application/* loadbalancer # You can use external file for mount points. # It will be checked for updates each 60 seconds. # The format of the file is: /url=worker # /examples/*=loadbalancer JkMountFile conf/uriworkermap.properties # Add shared memory. # This directive is present with 1.2.10 and # later versions of mod_jk, and is needed for # for load balancing to work properly JkShmFile logs/jk.shm # Add jkstatus for managing runtime data <Location /jkstatus/> JkMount status Order deny,allow Deny from all Allow from 127.0.0.1 </Location>
#JBoss conf Include conf/mod_jk.conf
/*=loadbalancer
# Define list of workers that will be used for mapping requests worker.list=loadbalancer,status # Load-balancing behaviour worker.loadbalancer.type=lb worker.loadbalancer.balance_workers=node1,node2 worker.loadbalancer.sticky_session=1 # Status worker for managing load balancer worker.status.type=status # Node1 worker.node1.port=8009 worker.node1.host=127.0.0.1 worker.node1.type=ajp13 worker.node1.lbfactor=1 worker.node1.cachesize=10 # Node2 worker.node2.port=8109 worker.node2.host=127.0.0.1 worker.node2.type=ajp13 worker.node2.lbfactor=1 worker.node2.cachesize=10
<property name="useJK">true</property> <property name="useSessionPassivation">true</property> <property name="passivationMaxIdleTime">-1</property> <property name="passivationMinIdleTime">-1</property>
<bean name="AttachmentStore" class="org.jboss.system.server.profileservice.repository.AbstractAttachmentStore"> <constructor><parameter class="java.io.File"><inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" /></parameter></constructor> ... </bean>
<bean name="PortsDefaultBindings" class="org.jboss.services.binding.impl.ServiceBindingSet"> <constructor> ... <parameter>100</parameter> ... </constructor> </bean>
<web-app> <display-name>Welcome to JBoss</display-name> <description> Welcome to JBoss </description> <distributable /> <servlet> <servlet-name>Status Servlet</servlet-name> <servlet-class>org.jboss.web.tomcat.service.StatusServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Status Servlet</servlet-name> <url-pattern>/status</url-pattern> </servlet-mapping> </web-app>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"> <jboss-web> <context-root>/</context-root> <replication-config> <replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger> <replication-granularity>SESSION</replication-granularity> <replication-field-batch-mode>True</replication-field-batch-mode> </replication-config> </jboss-web>
Apache+JBoss配置多实例+负载均衡(mod_jk实现)
原文地址:http://blog.csdn.net/tylanbin/article/details/39960411