Tiago Braga wrote:
In apache, the module mod_jk not changes IP of hostname when occurs
changing of IP on DNS.

Version of apache:
Server version: Apache/2.2.15 (Unix)
Server built:   Aug  2 2013 08:02:15

Version mod_jk: 1.2.37

Example:

workers.properties

worker.portalconsultoras_prd.type=ajp13
worker.portalconsultoras_prd.host=hostexample.com.br
worker.portalconsultoras_prd.port=8009

This configuration works fine.

But, when occurs change ip in the host name in DNS, the module md_jk starts
fail to connect. Follow below the log of mod_jk:

[Wed Sep 18 12:00:33 2013] [5315:140659824723936] [info]
jk_open_socket::jk_connect.c (627): connect to 107.xx.xx.220:8009 failed
(errno=115) [Wed Sep 18 12:00:33 2013] [5315:140659824723936] [info]
ajp_connect_to_endpoint::jk_ajp_common.c (995): Failed opening socket to
(107.xx.xxx.220:8009) (errno=115) [Wed Sep 18 12:00:33 2013]
[5315:140659824723936] [error] ajp_send_request::jk_ajp_common.c (1630):
(portalconsultoras_prd) connecting to backend failed. Tomcat is probably
not started or is listening on the wrong port (errno=115)

I would like a configuration of apache that avoid this problem.

Looking for the solutions in google, have turn on the "HostnameLookups",
but is inefficient.

.. and has nothing to do at all with the issue that you have. "HostnameLookups" (in Apache httpd), as far as I remember, is only for logging the *origin* of a request.

The basic issue here is this :
The mod_jk connector is written in such a way that it is very fast in transmitting requests from Apache httpd to Tomcat (we are talking ms or less). If each time it transmits a request to Tomcat, it had to do a DNS lookup before, this would be terrible for performance (a DNS lookup can take many many milliseconds). So it does not do that. With your configuration, it does a lookup once, when it reads its configuration, and then it caches the result (the IP address) and re-uses that cached IP address for all subsequent requests. There is nothing that you should or could change about that, otherwise the response time of your application is going to be just terrible.

Now the question becomes another one : it is quite unusual for a Tomcat server (and any server) to be bound to an IP address that changes. Why is that the case here ? Explain your configuration and the context a bit more, if you want better help.

Note : as a shortcut, if both your Apache httpd and your Tomcat are on the same host, then just do this :
worker.portalconsultoras_prd.host=127.0.0.1
(and make sure that the AJP Connector in Tomcat is listening on that address).


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to