![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jk2 uses a config file ( workers2.properties ) in the style of a .properties or ini file. It can be configured to use any other backend that provides similar capabilities. This document describes the format of this configuration file. Its default name is ${serverRoot}/conf/workers2.properties, where ${serverRoot} is something like /opt/apache.
The default config file is user editable, but mod_jk will persist the changes requested by protocol( not implemented). If you manually change the file while jk2 is working, your changes will be lost. The default configuration format . . Each setting consists of an object name and a property, with the associated value. The property name is a simple string, with no '.' in it. The name can be anything, but it must have a known 'type' as prefix. 2 formats are supported: TYPE:NAME.PROPERTY=VALUE and [TYPE:NAME] PROPERTY=VALUE
Each component instance has a name, that is used for configuration and at runtime. Each component has a number of configurable properties. The following rules are used:
Common properties for all components
This component represent the core jk2, it has the default logger for all other components. Is the central controller, it controls global properties and provides access to all other objects
The config component, hold the detail of the conifg system, such config file name, create global defines
Shared memory descriptor
A uri stores a pattern that is used to match requests to workers, and asociated properties
Represents the JVM when used as inprocess container
A channel represents a transport protocol, connecting 2 sides for RPC communication. The most common and standard is the tcp socket. Other important channels are unix socket and jni
AF_UNIX socket. Only on UNIX like platform. These sockets are faster than "normal" sockets but they are limited to the machine.
A communication transport to a remote Engine Magic: The local part of the name will be the Engine name, to use when defining the uri mappings. For example channel.socket.local_9009 will automatically define an engine named local_9009, and if no other setting is set ajp13 will be used for communication. Magic: If no channel is defined in the config, a default channel will be constructed with port=8009, engine=DEFAULT, worker=ajp13 - named 'channel.socket.DEFAULT'
The jni channel, used if tomcat is started inprocess
For the moment 4 worker types are supported: worker.jni,ajp13,status,lb.
worker used in inprocess, holds the details of the Tomcat class to startup, and paramters to pass
Default worker
Worker that outputs a page with usefull information to monitor JK2 To use it add a uri component assigned to this worker
Loadbalanced worker
Any connector based on jk2, at least has a default logger, that can be reached using the "logger" alias, the logger used is the more appropiate for the plataform/server combination, Apache2 under in any platform has logger.apache2 as default, IIS on his only platform uses logger.win32, and Any apache 1 install uses logger.file as default.., the config file lets you change that defaults, you can end using logger.file in IIs i.e The properties shared by all loggers are:
logger used in the IIS server by default, it ends at native Application Event Log.
Logger used in Apache2 servers, it normally in ends in error.log
The examples below are working when the Tomcat is configured according the examples described in the configtc file.
Map /examples to the Tomcat /examples context using a normal socket. Note the IP instead localhost (The JVM listens on the IPV4 address not no the IPV6).
[shm] file=${serverRoot}/logs/shm.file size=1048576 # Example socket channel, override port and host. [channel.socket:localhost:8019] port=8019 host=127.0.0.1 # define the worker [ajp13:localhost:8019] channel=channel.socket:localhost:8019 # Uri mapping [uri:/examples/*] worker=ajp13:localhost:8019
Map /jkstatus to the status worker.
[shm] file=${serverRoot}/logs/shm.file size=1048576 # define the worker [status:status] # Uri mapping [uri:/jkstatus/*] worker=status:status
Map /examples to the Tomcat /examples context using a AF_UNIX socket. Socket file is create by the Tomcat becarefull when the Web Server runs in a different user than the Tomcat with the permission of the socket file: apache20@jfcexpert:~/apache> ls -l /home1/jakarta/jakarta-tomcat-4.1/dist/work/jk2.socket srw-rw---- 1 jakarta jakarta 0 Jun 20 08:27 /home1/jakarta/jakarta-tomcat-4.1/dist/work/jk2.socketHere the Tomcat user and the Web Server user must be in the same group.
[shm] file=${serverRoot}/logs/shm.file size=1048576 # Example unixsocket channel. [channel.un:unixsocket] file=/home1/jakarta/jakarta-tomcat-4.1/dist/work/jk2.socket # define the worker [ajp13:unixsocket] channel=channel.un:unixsocket # Uri mapping [uri:/examples/*] worker=ajp13:unixsocket |