estou um pouco confuso ao configurar 2 tomcat6 cluster de instâncias em um servidor ubuntu limpo 12.04. Eu não instalei o padrão tomcat6
i usei tomcat6-user
' tomcat6-instance-create
para criar 2 instâncias. Estou usando o blogs.encodo.ch tutorial, infelizmente eu não encontrei nenhum tutorial Usando o Ubuntu com como o apache2
está configurado como o Ubuntu 12.o4. Quero dizer com isso, a estrutura da pasta sites-available/enabled
e mods-available/enabled
que o Ubuntu usa.
Eu instalei libapache2-mod-jk
e mods-enabled
tem jk.load, jk.conf.
server instance-1 uses port 8081 for http, port 8009 for ajp with jvmRoute="worker1" and instance-2 uses port 8082 for http, port 8010 for ajp with jvmRoute="worker2"
#/etc/apache2/workers.propeties
worker.list=loadbalancer,jk-status
#setup instance-1
worker.instance-1.port=8009
worker.instance-1.host=localhost
worker.instance-1.type=ajp13
#worker.instance-1.lbfactor=50
#setup instance-2
worker.instance-2.port=8010
worker.instance-2.host=localhost
worker.instance-2.type=ajp13
#worker.instance-2.lbfactor=100
#setup the load-balancer
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=instance-1,instance-2
worker.loadbalancer.sticky_session=True
#worker.loadbalancer.sticky_session_force=True
# Status worker for managing load balancer
worker.status.type=jk-status
aqui está o /etc/apache2/mods-available/jk.conf
<IfModule jk_module>
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkShmFile /var/log/apache2/jk-runtime-status
JkWatchdogInterval 60
<Location /jk-status>
# Inside Location we can omit the URL in JkMount
JkMount jk-status
Order deny,allow
Deny from all
Allow from 127.0.0.1 xxx.xxx.xxx.xxx
</Location>
<Location /jk-manager>
# Inside Location we can omit the URL in JkMount
JkMount jk-manager
Order deny,allow
Deny from all
Allow from 127.0.0.1 xxx.xxx.xxx.xxx
</Location>
# Example for Mounting a context to the worker "balancer"
# The URL syntax "a|b" instantiates two mounts at once,
# the first one is "a", the second one is "ab".
# JkMount /myapp|/* balancer
# Example for UnMounting requests for all workers
# using a simple URL pattern
# Since: 1.2.26
# JkUnMount /myapp/static/* *
# Example for UnMounting requests for a named worker
# JkUnMount /myapp/images/* balancer
# Example for UnMounting requests using regexps
# SetEnvIf REQUEST_URI "\.(htm|html|css|gif|jpg|js)$" no-jk
# Example for setting a reply timeout depending on the requets URL
# Since: 1.2.27
# SetEnvIf Request_URI "/transactions/" JK_REPLY_TIMEOUT=600000
# Example for disabling reply timeouts for certain request URLs
# Since: 1.2.27
# SetEnvIf Request_URI "/reports/" JK_REPLY_TIMEOUT=0
</IfModule>
aqui é meu virtualhost
<VirtualHost *:80>
ServerAdmin [email protected]
ServerAlias live.myserver.com
#DocumentRoot /var/www
ServerName go2.myserver.com
JkMount /* loadbalancer
JkMount /status/* jk-status
JkMount /jk-manager/* jk-status
#Loglevel warn
ErrorLog /var/log/apache2/go.myserver_error_log
CustomLog /var/log/apache2/go.myserver_access_log combined
</VirtualHost>
EDITAR: após algumas horas de luta, o balanceamento de carga parece funcionar. Só que não consigo acessar a página do gerenciador do balanceador de carga via xxx.xxx.xxx.xxx/jk-status
nor xxx.xxx.xxx.xxx/jk-manager
. Há também essas entradas no arquivo mod_jk.log
[Mon May 06 13:34:48.633 2013] [9845:139723554592576] [info] init_jk::mod_jk.c (3252): mod_jk/1.2.32 () initialized
[Mon May 06 13:34:48.633 2013] [9845:139723554592576] [error] uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'jk-manager' in uri map post processing.
[Mon May 06 13:34:48.633 2013] [9845:139723554592576] [error] uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'jk-status' in uri map p/var/log/apache2/mod_jk.log
Pergunta 1 : o que está faltando? porque não funciona?
Pergunta 2 : o #DocumentRoot /var/www
é realmente necessário?
Pergunta 3 : qual é a diferença entre o JkMount
no IfModule
do arquivo jk.conf e o JkMount
do virtualhost
Por favor, ajude-me a configurar corretamente. obrigado