Este contenido no está disponible en el idioma seleccionado.
Chapter 3. Configure load balancing using Apache HTTP Server and mod_jk
Follow the tasks in this chapter to correctly configure load balancing using Apache HTTP Server and the mod_jk connector.
Task: Configure Apache HTTP Server to Load mod_jk
Complete this task to configure Apache HTTP Server to load mod_jk.
Prerequisites
- Apache HTTP Server and mod_jk installed (Refer to Chapter 2, Download and install).
- Open
HTTPD_DIST/conf/httpd.conf
and add the following text at the end of the file.Include mod_jk's specific configuration file
# Include mod_jk's specific configuration file Include conf/mod-jk.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new file named
HTTPD_DIST/conf/mod-jk.conf
- Add the following configuration block to
mod-jk.conf
.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Confirm that the
LoadModule
directive references the right path for the mod_jk library. If not, edit the path. - The default configuration specifies that static content is served directly by Apache HTTP Server and all requests with URL path
/application/*
are sent to the load balancer. If mod_jk is only to be used as a load balancer, change the directive to/*
. Optional: JKMountFile Directive
In addition to theJkMount
directive, you can use theJkMountFile
directive to specify a mount point's 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 whose requests are to be forwarded and the name of the worker node to which they are to be forwarded, using the following syntax example as a guide.The example block will configure mod_jk to forward requests to
/jmx-console
and/web-console
to Apache HTTP Server.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.properties
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1. Configure worker nodes in mod_jk Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
Task: Configure mod_jk Worker Nodes
Complete this task to configure two mod_jk worker node definitions in a weighted round-robin configuration with sticky sessions active between two servlet containers.
Prerequisites
Understand the format of the
workers.properties
directives, as specified in Appendix A, Reference: workers.properties.
- Navigate to
HTTPD_DIST/conf/
. - Create a file named
workers.properties
. - Append the following information to
workers.properties
.Copy to Clipboard Copied! Toggle word wrap Toggle overflow