By Gal Shachor <shachor@il.ibm.com>
Trans By
Kenu <heogn@shinbiro.com>
mod_jk ´Â ÀÌÀüÀÇ mod_jservÀÇ ´ëÄ¡¿ëÀÔ´Ï´Ù. Tomcat °ú Apache ¸¦ ¿¬µ¿ÇÏ´Â ¾ÆÁÖ »õ·Î¿î Tomcat-Apache plugin ÀÔ´Ï´Ù.
¿©·¯ ÀÌÀ¯:
»õ·Ó°í ´Ü¼øÇÑ ¼³Ä¡±â¹ýÀ» ¾Ë ÇÊ¿ä°¡ ÀÖ°ÚÁÒ. ÀÌ ±â¹ýÀ» ¾Ë°ÔµÈ´Ù¸é IIS³ª Netscape °°Àº À¥¼¹ö¿¡ TomcatÀ» ¿¬µ¿ÇÒ ¶§ ¾ÆÁÖ ½±°Ô ÇÒ ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù.
ÀÌ ¹®¼¿¡¼ »ç¿ëµÇ´Â ´Ü¾îµéÀÇ ¶æÀº ´ÙÀ½°ú °°½À´Ï´Ù:
¿ë¾î |
ÀÇ¹Ì |
---|---|
Worker process |
worker´Â À¥¼¹ö·ÎºÎÅÍÀǼºí¸´ ¿äûÀ» ó¸®Çϱâ À§ÇØ µ¿ÀÛÇÏ´Â tomcat ÀνºÅϽºÀÔ´Ï´Ù. ´ëºÎºÐ ÇϳªÀÇ worker °¡ ÀÖ½À´Ï´Ù(ÇϳªÀÇ À¯ÀÏÇÑ tomcat process).±×·¯³ª ¶§·Î´Â load ¹ë·±½ÌÀ̳ª site ÆÄƼ¼Å´×À» À§ÇØ ¿©·¯°³ÀÇ worker¸¦ ¶ç¿ì°Ô µË´Ï´Ù. °¢°¢ÀÇ worker ´Â ÀÚ½ÅÀÌ ÀÚ¸®ÀâÀº È£½ºÆ®, ¿·ÁÀÖ´Â Æ÷Æ®, ¸Þ½ÃÁö ±³È¯¿¡ »ç¿ëµÇ´Â Åë½ÅÇÁ·ÎÅäÄÝ¿¡ ÀÇÇØ À¥¼¹ö¿¡¼ ±¸ºÐµÇ¾îÁý´Ï´Ù. |
In process worker |
Ưº°ÇÑ workerÀÔ´Ï´Ù. ´Ù¸¥ ÇÁ·Î¼¼½º¿¡ »óÁÖÇÏ°íÀÖ´Â Tomcat process ¿Í µ¿ÀÛÇÏ´Â ´ë½Å, À¥¼¹ö°¡ JVMÀ» ¿¾î¼ À¥¼¹ö process ÁÖ¼Ò °ø°£¿¡¼ TomcatÀ» ³»ºÎÀûÀ¸·Î ½ÇÇàÇÕ´Ï´Ù. ÀÌ ¹®¼¿¡¼´Â ´Ù·çÁö ¾Ê´Â ³»¿ëÀÔ´Ï´Ù. |
Web server plugin/tomcat redirector |
TomcatÀÌ ´Ù¸¥ À¥¼¹ö¿Í ÇÔ²² ¿î¿µµÉ ¶§ À¥¼¹ö¿¡ ¼³Ä¡Çؼ À¥¼¹ö·Î µé¾î¿À´Â servlet ¿äûÀ» TomcatÀ¸·Î º¸³»´Â ¿ªÇÐÀ» ÇÕ´Ï´Ù. À¥¼¹ö Ç÷¯±×ÀÎÀÌ°í, ÀÌ ¹®¼¿¡¼´Â À¥¼¹öÇ÷¯±×ÀÎÀ¸·Î mod_jk¸¦ ¼Ò°³ÇÕ´Ï´Ù. ÀÌ Àü¼ÛÀÚ´Â ¼¹ö¿¡ Ç÷¯±×ÀÎ µÇ±â À§ÇØ DLL(win32) / shared object(linux) ¸ðµâ ÇüÅ·ΠµÇ¾î ÀÖ½À´Ï´Ù. |
Plugin configuration |
¿©·¯ ´Ù¸¥ Tomcat worker°¡ µ¿ÀÛÇÒ °æ¿ì ¿äûÀÌ ¾î´À °÷À¸·Î Àü´ÞµÇ¾ß ÇÒ Áö ±¸ºÐÇϱâ À§ÇØ À¥¼¹öÇ÷¯±×ÀÎÀ» ¼³Á¤ÇÒ ÇÊ¿ä°¡ ÀÖ½À´Ï´Ù. ·Î±×·¹º§ °°Àº ¸î°¡Áö ³»ºÎ ÆĶó¹ÌÅÍ¿¡ ¼ö¹ÝµÈ ÀÌ Á¤º¸°¡ Ç÷¯±×ÀÎ ¼³Á¤À» ±¸¼ºÇÕ´Ï´Ù. |
Web server configuration |
°¢°¢ÀÇ ¼¹ö´Â ¾î¶»°Ô µ¿ÀÛÇÏ´ÂÁö Á¤ÀÇÇØÁÖ´Â ¼³Á¤À» °¡Áö°í ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¸é ¾î´À Æ÷Æ®¸¦ »ç¿ëÇÏ´ÂÁö, ¾î¶² ÆÄÀÏÀ» º¸³¾Áö, ¾î¶² À¥¼¹ö Ç÷¯±×ÀÎÀ» ºÒ·¯¿Í¾ß µÇ´ÂÁö µîµîÀÌÁÒ. Tocmat Àü´ÞÀÚ¸¦ ºÒ·¯¿Í »ç¿ëÇϱâ À§ÇØ À¥¼¹ö ¼³Á¤À» ¼öÁ¤ÇØÁÖ¾î¾ßÇÕ´Ï´Ù. |
¼³Ä¡¼ø¼´Â ´ÙÀ½°ú °°½À´Ï´Ù:
Apache¿¡ mod_jserv°¡ ¼³Ä¡µÇ¾ú´Ù¸é, httpd.conf ÆÄÀÏ¿¡¼ ApJServMount Áö½ÃÀÚ¸¦ ¸ðµÎ Á¦°ÅÇÕ´Ï´Ù. ¸¸ÀÏ tomcat-apache.conf ³ª tomcat.conf¸¦ Æ÷ÇÔÇÏ°í ÀÖ´Ù¸é ¿ä ÁÙµµ Áö¿öÁÝ´Ï´Ù. ÀÌ°ÍÀº mod_jserv¿¡ ¸ÂÃçÁ® ÀÖ½À´Ï´Ù.
Visual C++ Ver.6.0À¸·Î ¸¸µì´Ï´Ù. Á÷Á¢ ¸¸µé±â À§Çؼ´Â ÀÌ°Ô ±ò·ÁÀÖ¾î¾ß µË´Ï´Ù.
¼ø¼´Â ´ÙÀ½°ú °°½À´Ï´Ù.:
ÀÌ°ÍÀº ¹èÆ÷ÆÇ°ú µð¹ö±×¹öÀüÀ» ¸ðµÎ ¸¸µì´Ï´Ù(mod_jk).
´Ù¸¥ ¹æ¹ý: mod_jk.dsp ÆÄÀÏÀ» msdev¿¡¼ ¿¾î¼ build ¸Þ´º·Î ¸¸µé¾îµµ µË´Ï´Ù.
apxs -o mod_jk.so -DSOLARIS -I../jk -I/usr/java/include -I/usr/java/include/solaris -c *.c ../jk/*.c½Ã½ºÅÛº°·Î Àß µÇ°ÚÁö¸¸, ¸¸ÀÏ "symbol "fdatasync" not found" ¿¡·¯°¡ ³¯ ¶§°¡ ÀÖ½À´Ï´Ù. ¼öÁ¤ÇÏ·Á¸é, -lposix4 ¸¦ -c ¾Õ¿¡ Ãß°¡ÇØ ÁÖ½Ã¸é µË´Ï´Ù.
apxs -o mod_jk.so -I../jk -I/usr/local/jdk/include -I/usr/local/jdk/include/linux -c *.c ../jk/*.c¼Ò½º µð·ºÅ丮°¡ ¾Æ´Ñ ../jk µð·ºÅ丮¿¡¼ ³ª¿Â objects ÆÄÀϵéÀÌ ÇöÀç µð·ºÅ丮¿¡ ÄÄÆÄÀϵDZ⠶§¹®¿¡ ½ÇÆÐÇÒ ¼öµµ ÀÖ½À´Ï´Ù. ±× ¶§´Â gcc -shared -o mod_jk.so *.o ¸¦ µ¹·Á¼ build ¸¦ ¸¶ÃÄ¾ß ÇÕ´Ï´Ù.
ÀÌ¹Ì servlet.xml ÆÄÀÏÀº ÀÌ ºÎºÐ°ú À¯»çÇÑ 8007Æ÷Æ®¸¦ »ç¿ëÇÏ´Â Ajp12 connections À» Æ÷ÇÔÇÏ°í ÀÖ½À´Ï´Ù(mod_jserv ¿¡ ÀÇÇØ Àü´ÞµÊ). Ajp13¸¸ »ç¿ëÇÏ°í ½Í¾îµµ, Ajp12 Ä¿³ØÅ͸¦ Áö¿ìÁö ¸¶½ÃÁÒ(?) - TomcatÀÇ shutdown¿¡ ÇÊ¿äÇÏ´ð´Ï´Ù.<Connector className="org.apache.tomcat.service.PoolTcpConnector"> <Parameter name="handler" value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/> <Parameter name="port" value="8009"/> </Connector>
´ëºÎºÐ ´Ü¼øÇÑ °æ¿ì TomcatÀº Apache¿¡ ÇÊ¿äÇÑ È¯°æ¼³Á¤ ÆÄÀϵéÀ» »ý¼ºÇÕ´Ï´Ù. Tomcat ÀÌ ±¸µ¿ÇÒ ¶§ Apache ¸¦ À§ÇØ
TOMCAT_HOME/conf/mod_jk.conf-auto ÆÄÀÏÀ» ÀÚµ¿À¸·Î »ý¼ºÇÕ´Ï´Ù. ¿ì¸®°¡ ÇÒ ÀÏÀº ´ÜÁö ÀÌ ÆÄÀÏÀ»
httpd.conf ÆÄÀÏ¿¡ ´ÙÀ½°ú °°ÀÌ ÇÑÁÙÀ» ÷°¡ÇÏ´Â °Í »ÓÀÔ´Ï´Ù.
"Include
TOMCAT_HOME/conf/mod_jk.conf-auto"
Ok, ÀÌÁ¦ Tomcat °ú Apache¸¦ ½ÃÀÛÇϸé
Apache¼¹ö¿¡¼ Tomcat¿¡ Á¢±ÙÇÒ ¼ö ÀÖ½À´Ï´Ù.
Ưº°ÇÑ °æ¿ì, ¿¹¸¦ µé¸é ±âº»°ªÀÌ ¾Æ´Ñ URL prefixes ¸¶¿îÆà ½Ã¿¡ ÀÌ ÆÄÀÏÀ» Ä¿½ºÅ͸¶ÀÌÁîµÈ ¼³Á¤ÀÇ ±â¹ÝÀ¸·Î »ï°í, ´Ù¸¥ ÆÄÀÏ À̸§À¸·Î ÀúÀåÇÕ´Ï´Ù. Apache¸¦ Á÷Á¢ °ü¸®ÇÑ´Ù¸é »õ·Î¿î ÄÁÅؽºÆ®°¡ Ãß°¡µÉ ¶§¸¶´Ù Apache¸¦ UpdateÇؾßÇÕ´Ï´Ù.
Tomcat 3.2: »õ context ¸¦ Ãß°¡ÇÑ µÚ¿¡ tomcat°ú apache ¸ðµÎ Àç½ÃÀÛÇؾßÇÕ´Ï´Ù;
Apache´Â Àç½ÃÀÛÇؾ߸¸ º¯ÈµÈ ¼³Á¤°ªÀÌ Àû¿ëµË´Ï´Ù.
¶ÇÇÑ,
TOMCAT_HOME/conf/mod_jk.conf-auto ÆÄÀÏÀº tomcatÀÌ ½ÃÀÛÇÒ ¶§ »ý¼ºµÇ¹Ç·Î, Apache¸¦ ½ÃÀÛÇϱâ
Àü¿¡ TomcatÀ» ½ÃÀÛÇؾßÇÕ´Ï´Ù. TomcatÀº ¸Å¹ø »õ·Î ½ÃÀÛÇÒ ¶§¸¶´Ù
TOMCAT_HOME/conf/mod_jk.conf-auto ÆÄÀÏÀ» µ¤¾î¾¹´Ï´Ù.
Worker´Â TOMCAT_HOME/conf/workers.properties ÆÄÀÏ·Î ¼³Á¤µË´Ï´Ù. workers.properties howto ¹®¼¿¡´Â »ó´çÇÑ ºÐ·®ÀÇ Á¤º¸°¡ ÀÖ°í, ¸ÕÀú ¾Ë°í ÀÖ¾î¾ß ÇÕ´Ï´Ù. ±×·¯³ª, ±ÞÇϽôٸé workers.properties ÆÄÀÏÀ» ÆíÁýÇÏ°í workers.tomcat_home, workers.java_home ÆÄÀÏ°ú ½Ã½ºÅÛ¿¡ ¸Â´Â ps º¯¼ö°ªµéÀ» ¼¼ÆÃÇÏÁö ¾Ê¾Æµµ µË´Ï´Ù.
mod_jk¸¦ »ç¿ëÇϱâ À§ÇÑ Apache ¼³Á¤¹ýÀº Apache ¼¹ö ¼³Á¤ Áö½ÃÀÚ¸¦ ÅëÇØ ÀÌ·ç¾îÁø´Ù; ½ÃÀÛÇÏ·Á¸é ÀÚµ¿ »ý¼ºµÈ Tomcat ÀÇ conf Æú´õ¿¡ ÀÖ´Â mod_jk.conf-auto ÆÄÀÏÀ» º»´Ù.
LoadModule jk_module libexec/mod_jk.so AddModule mod_jk.c JkWorkersFile /usr/local/jakarta-tomcat/conf/workers.properties JkLogFile /usr/local/apache/logs/mod_jk.log JkLogLevel warn
mod_jkÀÇ JkMount Áö½ÃÀÚ¸¦ »ç¿ëÇØ ÁöÁ¤µÈ URL µéÀ» TomcatÀ¸·Î ÇÒ´çÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀϹÝÀûÀ¸·Î JkMount Áö½ÃÀÚÀÇ ±¸Á¶´Â ´ÙÀ½°ú °°½À´Ï´Ù:
JkMount <URL prefix> <Worker name>
¿¹¸¦ µé¾î ´ÙÀ½ÀÇ Áö½ÃÀÚµéÀº .jsp·Î ³¡³ª´Â ¿äûµéÀ̳ª /servlet À¸·Î ½ÃÀÛÇÏ´Â ¸ðµç ¿äûµéÀº "ajp13" worker·Î º¸³À´Ï´Ù. ±×·¯³ª /otherworker ¿¡ ÀÖ´Â .jsp ¿äûÀº "remoteworker" ·Î º¸³À´Ï´Ù.
httpd.conf ÆÄÀÏ¿¡¼ JkMount Áö½ÃÀÚ¸¦ Top·¹º§ À̳ª <VirtualHost> ¼½¼Ç ³»ºÎ¿¡ µÒÀ¸·Î »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 JkMount /otherworker/*.jsp remoteworker
³¡³µ½À´Ï´Ù! ÀÌÁ¦ Tomcat°ú apache¸¦ ½ÃÀÛÇÔÀ¸·Î µÎ ¼¹ö°¡ µ¿ÀÛÇÏ¸é¼ ¼ºí¸´°ú JSP ÆÄÀϵéÀ» µ¹¸± ¼ö ÀÖ½À´Ï´Ù.
. . <Connector className="org.apache.tomcat.service.PoolTcpConnector"> <Parameter name="handler" value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/> <Parameter name="port" value="8007"/> </Connector> <Connector className="org.apache.tomcat.service.PoolTcpConnector"> <Parameter name="handler" value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/> <Parameter name="port" value="8009"/> </Connector> <Host name="host1.apache.org"> <Context path="" docBase="/web/host1" debug="0"/> </Host> <Host name="host2.apache.org"> <Context path="" docBase="/web/host2" debug="0"/> </Host> . . |
# Setup for Solaris system # workers.tomcat_home=/usr/local/jakarta-tomcat workers.java_home=/usr/java ps=/ worker.list=ajp12, ajp13 # Definition for Ajp13 worker (Ajp12 left to readers imagination) # worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 |
# Load mod_jk # LoadModule jk_module libexec/mod_jk.so AddModule mod_jk.c # Configure mod_jk # JkWorkersFile /usr/local/jakarta-tomcat/conf/workers.properties JkLogFile /usr/local/apache/logs/mod_jk.log JkLogLevel warn # First Virtual Host. # <VirtualHost 10.0.0.1:80> DocumentRoot /web/host1 ServerName host1.apache.org JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 </VirtualHost> # Second Virtual Host. Also accessible via HTTPS # <VirtualHost 10.0.0.2:80> DocumentRoot /web/host2 ServerName host2.apache.org JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 </VirtualHost> <VirtualHost 10.0.0.2:443> DocumentRoot /web/host2 ServerName host2.apache.org SSLEngine On JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 </VirtualHost> |
This document was created by Gal Shachor, and was revised by Mike Bremford with help from the countless many on the tomcat-dev and tomcat-user lists!
Copyright ©1999-2000 The Apache Software
Foundation |