Este conteúdo não está disponível no idioma selecionado.
Chapter 3. Configure Load Balancing Using Apache and mod_jk
Follow the tasks in this chapter to correctly configure load balancing using Apache and the mod_jk connector.
Procedure 3.1. Configure Apache to Load mod_jk
Ensure that Apache and mod_jk are installed (Refer to Chapter 2, Download and Install).
- Open
HTTPD_DIST/conf/httpd.confand add a single line at the end of the file.Include mod_jk's specific configuration file
# Include mod_jk's specific configuration file Include conf/mod-jk.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new file named
HTTPD_DIST/conf/mod-jk.conf - Add the following configuration to the
mod-jk.conffile.Important
TheLoadModuledirective must reference the mod_jk library directory location applicable to the native binary you installed.Note
TheJkMountdirective specifies which URLs Apache should forward to the mod_jk module. Based on the directive's configuration, mod_jk forwards the received URL onto the correct Servlet containers.To enable Apache to serve static content (or PHP content) directly, and only use the load balancer for Java applications, the suggested configuration specifies all requests with URL path/application/*are sent to the mod_jk load-balancer.If you only use mod_jk as a load balancer, forward all URLs to mod_jk by specifying/*in the directive.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: JKMountFile Directive
In addition to theJkMountdirective, you can use theJkMountFiledirective to specify a mount points configuration file. The configuration file contains multiple Tomcat forwarding URL mappings.- Navigate to
HTTPD_DIST/conf. - Create a file named
uriworkermap.properties. - Specify the URL to forward and the worker name using the following syntax example as a guide.The example block will configure mod_jk to forward requests to
/jmx-consoleand/web-consoleto Apache.The syntax required takes the form/url=worker_name.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In
HTTPD_DIST/conf/mod-jk.conf, append the following directive.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
# 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.propertiesCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1. Configuring Worker Nodes in mod_jk Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Complete the following task to configure two mod_jk Worker node definitions in a weighted round robin configuration with sticky sessions active between two servlet containers.
Procedure 3.2. Configure mod_jk Worker Nodes
As a prerequisite, understand the format of the
workers.properties directives, as specified in Appendix A, workers.properties Reference and configure mod_jk (refer to Procedure 3.1, “Configure Apache to Load mod_jk ”).
- Navigate to
HTTPD_DIST/conf/. - Create a file named
workers.properties. - Append the following information into the
workers.propertiesfile.Copy to Clipboard Copied! Toggle word wrap Toggle overflow