You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Oliver Hookins <ol...@anchor.com.au> on 2005/11/04 04:11:33 UTC

Unix socket communications on Tomcat 5.5

I've been trying to find some decent documentation on setting up Tomcat 
to communicate with mod_jk2 and Apache over unix sockets. So far what 
I've found suggests I only need to alter jk2.properties with details of 
the socket, and workers2.properties with the same details. I've done 
this and restarted Tomcat and it still appears to be creating the TCP/IP 
socket on port 8009, but not creating any unix socket file.

Has anyone got a working Tomcat 5.5 mod_jk2 configuration using Unix 
sockets I'd love to know what you did to set it up.

-- 
Thanks,
Oliver

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


Re: Unix socket communications on Tomcat 5.5

Posted by Pau Garcia i Quiles <pg...@elpauer.org>.
Quoting Nikola Milutinovic <Ni...@ev.co.yu>:

Talking about JNI, Unix and Java, what about this?
http://freshmeat.net/projects/nl.hen.ictjavapackage/

It may be useful. It has versions for Linux and Solaris and I do know 
the author
would be pleased to provide the source code.

> Oliver Hookins wrote:
>
>> I've been trying to find some decent documentation on setting up 
>> Tomcat to communicate with mod_jk2 and Apache over unix sockets. So 
>> far what I've found suggests I only need to alter jk2.properties 
>> with details of the socket, and workers2.properties with the same 
>> details. I've done this and restarted Tomcat and it still appears to 
>> be creating the TCP/IP socket on port 8009, but not creating any 
>> unix socket file.
>>
>> Has anyone got a working Tomcat 5.5 mod_jk2 configuration using Unix 
>> sockets I'd love to know what you did to set it up.
>
>
> Hmm, well, there are several things to consider.
>
> First, in order to use UNIX socket, you need to have and link JNI 
> library specially built for your OS. UNIX sockets are not a part of 
> Java world and to use them you need JNI library which is a part of 
> mod_jk2 source distribution. You'll also need Apache-Dev RPMs or 
> libapr+libaprutil, if I recall correctly.
>
> Then you need something like this (this is from my 4.1.24)
>
> jk2.config
> ----------
> apr.NativeSo=/usr/lib/apache2-extramodules/jkjni.so
> handler.list=apr,request,channelUnix
> channelUnix.file=${jkHome}/work/tomcat.sock
> request.tomcatAuthentication=false
>
> workers2.properties
> ---------------------
> [logger]
> level=DEBUG
>
> [config:]
> debug=0
> debugEnv=0
>
> [uriMap:]
> info=Maps the requests. Options: debug
> debug=0
>
> # Alternate file logger
> [logger.file:0]
> level=DEBUG
> file=/var/log/httpd/mod_jk2.log
>
> [shm:]
> info=Scoreboard. Required for reconfiguration and status with 
> multiprocess servers
> file=/var/run/jk2.shm
> size=1000000
> debug=0
> disabled=0
>
> [workerEnv:]
> info=Global server options
> timing=1
> debug=0
>
> [channel.un:unixsock]
> info=Main socket to Tomcat engine
> file=/var/tomcat4/work/tomcat.sock
>
> [status:]
> info=Status worker, displays runtime informations
>
> [ajp13:unixsock]
> info=Default AJP 1.3 worker
> channel=channel.un:unixsock
>
> [uri:/jkstatus/*]
> info=Display status information and checks the config file for changes.
> group=status:
>
> [uri:www.elektrovojvodina.co.yu/racun]
> info=Uvid u racun potrosaca
> group=ajp13:unixsock
> #context=/racun
>
> It should be very similar to mod_jk.
>
> Nix.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>




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


Re: Unix socket communications on Tomcat 5.5

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
Oliver Hookins wrote:

> I've been trying to find some decent documentation on setting up 
> Tomcat to communicate with mod_jk2 and Apache over unix sockets. So 
> far what I've found suggests I only need to alter jk2.properties with 
> details of the socket, and workers2.properties with the same details. 
> I've done this and restarted Tomcat and it still appears to be 
> creating the TCP/IP socket on port 8009, but not creating any unix 
> socket file.
>
> Has anyone got a working Tomcat 5.5 mod_jk2 configuration using Unix 
> sockets I'd love to know what you did to set it up.


Hmm, well, there are several things to consider.

First, in order to use UNIX socket, you need to have and link JNI 
library specially built for your OS. UNIX sockets are not a part of Java 
world and to use them you need JNI library which is a part of mod_jk2 
source distribution. You'll also need Apache-Dev RPMs or 
libapr+libaprutil, if I recall correctly.

Then you need something like this (this is from my 4.1.24)

jk2.config
----------
apr.NativeSo=/usr/lib/apache2-extramodules/jkjni.so
handler.list=apr,request,channelUnix
channelUnix.file=${jkHome}/work/tomcat.sock
request.tomcatAuthentication=false

workers2.properties
---------------------
[logger]
level=DEBUG

[config:]
debug=0
debugEnv=0

[uriMap:]
info=Maps the requests. Options: debug
debug=0

# Alternate file logger
[logger.file:0]
level=DEBUG
file=/var/log/httpd/mod_jk2.log

[shm:]
info=Scoreboard. Required for reconfiguration and status with 
multiprocess servers
file=/var/run/jk2.shm
size=1000000
debug=0
disabled=0

[workerEnv:]
info=Global server options
timing=1
debug=0

[channel.un:unixsock]
info=Main socket to Tomcat engine
file=/var/tomcat4/work/tomcat.sock

[status:]
info=Status worker, displays runtime informations

[ajp13:unixsock]
info=Default AJP 1.3 worker
channel=channel.un:unixsock

[uri:/jkstatus/*]
info=Display status information and checks the config file for changes.
group=status:

[uri:www.elektrovojvodina.co.yu/racun]
info=Uvid u racun potrosaca
group=ajp13:unixsock
#context=/racun

It should be very similar to mod_jk.

Nix.

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


Re: Unix socket communications on Tomcat 5.5

Posted by Oliver Hookins <ol...@anchor.com.au>.
Bill Barker wrote:
> "Oliver Hookins" <ol...@anchor.com.au> wrote in message 
> news:436B015D.2000709@anchor.com.au...
> 
>>Richard Mixon wrote:
>>
>>>Oliver,
>>>
>>>Unless you have a special reason to use mod_jk2, you should probably be
>>>using mod_jk instead. See:
>>>  http://tomcat.apache.org/connectors-doc/news/20041100.html#20041115.1
>>>
>>>The mod_jk documentation for 5.5. is here::
>>>  http://tomcat.apache.org/connectors-doc/
>>>
>>>Now, if you really need to stay with mod_jk2, hopefully someone else can
>>>help.
>>
>>I had no idea mod_jk was now the current tomcat connector module, so I'll 
>>use that if it is more appropriate. If you can give me a quick idea of how 
>>to set that up with unix sockets that would be great.
>>
> 
> 
> Currently mod_jk doesn't support unix sockets (ditto for mod_proxy_ajp :). 
> To use unix sockets currently, you must use (the currently unsupported) 
> mod_jk2.
> 
> However, there is some intial support for them in the new APR Connector. 
> It's not complete (and so not usable :),  but it's possible that some future 
> version of mod_jk/Tomcat will support this.

At the moment it is looking too hard to get working so I think I'm going 
to leave it. Thanks for the help though.

> 
> 
>>>HTH - Richard
>>>
>>>-----Original Message-----
>>>From: Oliver Hookins [mailto:oliver.hookins@anchor.com.au] Sent: 
>>>Thursday, November 03, 2005 8:12 PM
>>>To: users@tomcat.apache.org
>>>Subject: Unix socket communications on Tomcat 5.5
>>>
>>>I've been trying to find some decent documentation on setting up Tomcat 
>>>to
>>>communicate with mod_jk2 and Apache over unix sockets. So far what I've
>>>found suggests I only need to alter jk2.properties with details of the
>>>socket, and workers2.properties with the same details. I've done this and
>>>restarted Tomcat and it still appears to be creating the TCP/IP socket on
>>>port 8009, but not creating any unix socket file.
>>>
>>>Has anyone got a working Tomcat 5.5 mod_jk2 configuration using Unix 
>>>sockets
>>>I'd love to know what you did to set it up.
>>>
>>>--
>>>Thanks,
>>>Oliver
>>>

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


Re: Unix socket communications on Tomcat 5.5

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
Bill Barker wrote:

>Currently mod_jk doesn't support unix sockets (ditto for mod_proxy_ajp :). 
>To use unix sockets currently, you must use (the currently unsupported) 
>mod_jk2.
>
>However, there is some intial support for them in the new APR Connector. 
>It's not complete (and so not usable :),  but it's possible that some future 
>version of mod_jk/Tomcat will support this.
>  
>

I'm sad to hear that. The story of mod_jk/mod_jk2 succession was that 
all nifty features of mod_jk2 will be ported to mod_jk.

I must say I have UNIX socket on mod_jk2 in a Mandrake 9.1 Linux Apache 
2.0, TC 4.1.24 and it is working without a glitch. I haven't stress 
tested it, though.

Can anyone comment on the need for a UNIX socket?

The basic idea was that UNIX socket is faster, but with the advance of 
kernels, is net socket communication that burdening? OK, on a busy 
server, it could profitable to lay off as much traffic off the network 
stack, as possible. Can someone give insight?

Currently, I have mod_jk2 in a good working condition and I have access 
to both mod_jk2 and mod_jk. I'm not about to switch to mod_jk, just for 
switching's sake. On the other hand, I'm not going to stick to obsoleted 
softrware, either. So, I'm waiting (patiently) for expert opinion.

Nix.

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


Re: Unix socket communications on Tomcat 5.5

Posted by Bill Barker <wb...@wilshire.com>.
"Oliver Hookins" <ol...@anchor.com.au> wrote in message 
news:436B015D.2000709@anchor.com.au...
> Richard Mixon wrote:
>> Oliver,
>>
>> Unless you have a special reason to use mod_jk2, you should probably be
>> using mod_jk instead. See:
>>   http://tomcat.apache.org/connectors-doc/news/20041100.html#20041115.1
>>
>> The mod_jk documentation for 5.5. is here::
>>   http://tomcat.apache.org/connectors-doc/
>>
>> Now, if you really need to stay with mod_jk2, hopefully someone else can
>> help.
>
> I had no idea mod_jk was now the current tomcat connector module, so I'll 
> use that if it is more appropriate. If you can give me a quick idea of how 
> to set that up with unix sockets that would be great.
>

Currently mod_jk doesn't support unix sockets (ditto for mod_proxy_ajp :). 
To use unix sockets currently, you must use (the currently unsupported) 
mod_jk2.

However, there is some intial support for them in the new APR Connector. 
It's not complete (and so not usable :),  but it's possible that some future 
version of mod_jk/Tomcat will support this.

>>
>> HTH - Richard
>>
>> -----Original Message-----
>> From: Oliver Hookins [mailto:oliver.hookins@anchor.com.au] Sent: 
>> Thursday, November 03, 2005 8:12 PM
>> To: users@tomcat.apache.org
>> Subject: Unix socket communications on Tomcat 5.5
>>
>> I've been trying to find some decent documentation on setting up Tomcat 
>> to
>> communicate with mod_jk2 and Apache over unix sockets. So far what I've
>> found suggests I only need to alter jk2.properties with details of the
>> socket, and workers2.properties with the same details. I've done this and
>> restarted Tomcat and it still appears to be creating the TCP/IP socket on
>> port 8009, but not creating any unix socket file.
>>
>> Has anyone got a working Tomcat 5.5 mod_jk2 configuration using Unix 
>> sockets
>> I'd love to know what you did to set it up.
>>
>> --
>> Thanks,
>> Oliver
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> -- 
> Regards,
> Oliver Hookins
> Anchor Systems 




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


Re: Unix socket communications on Tomcat 5.5

Posted by Oliver Hookins <ol...@anchor.com.au>.
Richard Mixon wrote:
> Oliver,
> 
> Unless you have a special reason to use mod_jk2, you should probably be
> using mod_jk instead. See:
>   http://tomcat.apache.org/connectors-doc/news/20041100.html#20041115.1
> 
> The mod_jk documentation for 5.5. is here::
>   http://tomcat.apache.org/connectors-doc/
> 
> Now, if you really need to stay with mod_jk2, hopefully someone else can
> help.

I had no idea mod_jk was now the current tomcat connector module, so 
I'll use that if it is more appropriate. If you can give me a quick idea 
of how to set that up with unix sockets that would be great.

> 
> HTH - Richard
> 
> -----Original Message-----
> From: Oliver Hookins [mailto:oliver.hookins@anchor.com.au] 
> Sent: Thursday, November 03, 2005 8:12 PM
> To: users@tomcat.apache.org
> Subject: Unix socket communications on Tomcat 5.5
> 
> I've been trying to find some decent documentation on setting up Tomcat to
> communicate with mod_jk2 and Apache over unix sockets. So far what I've
> found suggests I only need to alter jk2.properties with details of the
> socket, and workers2.properties with the same details. I've done this and
> restarted Tomcat and it still appears to be creating the TCP/IP socket on
> port 8009, but not creating any unix socket file.
> 
> Has anyone got a working Tomcat 5.5 mod_jk2 configuration using Unix sockets
> I'd love to know what you did to set it up.
> 
> --
> Thanks,
> Oliver
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


-- 
Regards,
Oliver Hookins
Anchor Systems

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


RE: Unix socket communications on Tomcat 5.5

Posted by Richard Mixon <rn...@qwest.net>.
Oliver,

Unless you have a special reason to use mod_jk2, you should probably be
using mod_jk instead. See:
  http://tomcat.apache.org/connectors-doc/news/20041100.html#20041115.1

The mod_jk documentation for 5.5. is here::
  http://tomcat.apache.org/connectors-doc/

Now, if you really need to stay with mod_jk2, hopefully someone else can
help.

HTH - Richard

-----Original Message-----
From: Oliver Hookins [mailto:oliver.hookins@anchor.com.au] 
Sent: Thursday, November 03, 2005 8:12 PM
To: users@tomcat.apache.org
Subject: Unix socket communications on Tomcat 5.5

I've been trying to find some decent documentation on setting up Tomcat to
communicate with mod_jk2 and Apache over unix sockets. So far what I've
found suggests I only need to alter jk2.properties with details of the
socket, and workers2.properties with the same details. I've done this and
restarted Tomcat and it still appears to be creating the TCP/IP socket on
port 8009, but not creating any unix socket file.

Has anyone got a working Tomcat 5.5 mod_jk2 configuration using Unix sockets
I'd love to know what you did to set it up.

--
Thanks,
Oliver

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



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