로고

슈퍼로그
  • 고객지원
  • 기술자료실
  • 고객지원

    기술자료실

    [팁] Apache 와 Tomcat 여러개 연동 방법

    페이지 정보

    profile_image
    작성자 슈퍼로그
    댓글 0건 조회 6,663회 작성일 11-07-28 21:39

    본문

    일반 적으로 많이 사용 하시는 Tomcat 로드밸런싱 및 세션 클러스터링이 아닌 톰캣이 물리적으로 2개 있을 경우 설정입니다.
    우선 24번 서버에 Apache가 설치 되어있어야 합니다.


    [서버 구성 정보]
    192.168.0.24 : Apache
    192.168.0.31  tomcat1
    192.168.0.32  tomcat2

    공통 (192.168.0.24/192.168.0.31/192.168.0.32)

    [JDK 설치]
    [root@localhost src]# chmod 777 jdk-1_5_0_16-linux-i586.bin
    [root@localhost src]# ./jdk-1_5_0_16-linux-i586.bin

    yes

    [root@localhost src]# vi /etc/profile
    export JAVA_HOME=/usr/java/default


    source /etc/profile


    Apache (192.168.0.24)
    http://ftp.daum.net/apache//tomcat/tomcat-connectors/jk/source/jk-1.2.31/tomcat-connectors-1.2.31-src.tar.gz
    [root@localhost src]# tar xvfz tomcat-connectors-1.2.31-src.tar.gz
    [root@localhost src]# cd /usr/local/src/tomcat-connectors-1.2.31-src/native
    [root@localhost native]# ./buildconf.sh
    [root@localhost native]# ./configure --with-apxs=/usr/local/apache/bin/apxs
    [root@localhost native]# make
    [root@localhost native]# make install

    [Mod_JK 설치]
    [root@localhost src]# cd /usr/local/src/
    [root@localhost src]# wget


    [root@localhost native]# ls -altr /usr/local/apache/modules/mod_jk.so
    [root@localhost native]# cd /usr/local/apache/conf


    [httpd.conf 설정]
    [root@localhost conf]# vi httpd.conf

    LoadModule jk_module modules/mod_jk.so
    JkWorkersFile conf/workers.properties
    Include conf/extra/httpd-vhosts.conf


    [Vhost 설정]
    [root@localhost conf]# vi ./extra/httpd-vhost.conf
    NameVirtualHost *:80



    ServerName number1.ucert.co.kr
    JkMount /* confluence
     



    ServerName number2.ucert.co.kr
    JkMount /* forum
     


    [workers.properties 설정]
    [root@localhost conf]# vi workers.properties


    workers.java_home=/usr/local/java


    worker.list=confluence, forum
    worker.confluence.port=8009
    worker.confluence.host=192.168.0.31
    worker.confluence.type=ajp13
    worker.forum.port=8009
    worker.forum.host=192.168.0.32
    worker.forum.type=ajp13



    Tomcat 공통 (192.168.0.31/192.168.0.32)


    [Tomcat 설치]

    [root@localhost conf]# cd /usr/local/src
    [root@localhost src]# wget http://apache.tt.co.kr/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz
    [root@localhost src]# tar xvfz apache-tomcat-6.0.32.tar.gz
    [root@localhost src]# mv ./apache-tomcat-6.0.32.tar.gz /usr/loacal/tomcat6
    [root@localhost src]# cd /usr/local/tomcat6/bin/
    [root@localhost bin]# startup.sh


    [포트 사용 확인]

    [root@localhost bin]# lsof -i


    COMMAND    PID    USER   FD   TYPE DEVICE SIZE NODE NAME
    dhclient  1596    root    4u  IPv4   4236       UDP *:bootpc
    portmap   1712     rpc    3u  IPv4   4516       UDP *:sunrpc
    portmap   1712     rpc    4u  IPv4   4517       TCP *:sunrpc (LISTEN)
    rpc.statd 1744 rpcuser    3u  IPv4   4678       UDP *:ieee-mms
    rpc.statd 1744 rpcuser    6u  IPv4   4661       UDP *:rrp
    rpc.statd 1744 rpcuser    7u  IPv4   4699       TCP *:aodv (LISTEN)
    hpiod     1932    root    0u  IPv4   5162       TCP localhost.localdomain:2208 (LISTEN)
    hpssd.py  1937    root    4u  IPv4   5189       TCP localhost.localdomain:2207 (LISTEN)
    sshd      1958    root    3u  IPv6   5240       TCP *:ssh (LISTEN)
    cupsd     1967    root    4u  IPv4   5275       TCP localhost.localdomain:ipp (LISTEN)
    cupsd     1967    root    6u  IPv4   5278       UDP *:ipp
    master    2034    root   11u  IPv4   5537       TCP localhost.localdomain:smtp (LISTEN)
    avahi-dae 2139   avahi   13u  IPv4   5903       UDP *:mdns
    avahi-dae 2139   avahi   14u  IPv6   5904       UDP *:mdns
    avahi-dae 2139   avahi   15u  IPv4   5905       UDP *:43325
    avahi-dae 2139   avahi   16u  IPv6   5906       UDP *:35981
    sshd      2610    root    3u  IPv6   8990       TCP 192.168.0.32:ssh->192.168.0.8:canocentral0 (ESTABLISHED)
    java      3004    root   34u  IPv6  19690       TCP *:webcache (LISTEN)
    java      3004    root   42u  IPv6  19703       TCP *:8009 (LISTEN)
    java      3004    root   44u  IPv6  19707       TCP localhost.localdomain:8005 (LISTEN)


    Tomcat1 (192.168.0.31)

    [root@localhost bin]# vi /usr/local/tomcat6/webapps/ROOT/index.html
    TEST-1


    Tomcat2 (192.168.0.32)

    [root@localhost bin]# vi /usr/local/tomcat6/webapps/ROOT/index.html
    TEST-2


    Client PC (192.168.0.8)


    C:\WINDOWS\system32\drivers\etc\hosts


    192.168.0.24 number1.ucert.co.kr
    192.168.0.24 number2.ucert.co.kr

    웹브라우저를 통하여 접속하여 정상적으로 구분 되는지 확인 합니다.

    Tomcat1 (192.168.0.31)

    포트 사용 내역 확인


    [root@localhost ROOT]# lsof -i
    java      3030    root   34u  IPv6  18469       TCP *:webcache (LISTEN)
    java      3030    root   42u  IPv6  18482       TCP *:8009 (LISTEN)
    java      3030    root   43u  IPv6  18483       TCP 192.168.0.31:8009->192.168.0.24:36693 (ESTABLISHED)
    java      3030    root   44u  IPv6  18486       TCP localhost.localdomain:8005 (LISTEN)
    java      3030    root   46u  IPv6  20812       TCP 192.168.0.31:8009->192.168.0.24:36694 (ESTABLISHED)
    java      3030    root   47u  IPv6  20813       TCP 192.168.0.31:8009->192.168.0.24:57763 (ESTABLISHED)
    java      3030    root   48u  IPv6  20851       TCP 192.168.0.31:8009->192.168.0.24:57764 (ESTABLISHED)
    java      3030    root   49u  IPv6  20852       TCP 192.168.0.31:8009->192.168.0.24:57765 (ESTABLISHED)
    java      3030    root   50u  IPv6  20853       TCP 192.168.0.31:8009->192.168.0.24:57766 (ESTABLISHED)
    java      3030    root   51u  IPv6  20854       TCP 192.168.0.31:8009->192.168.0.24:57767 (ESTABLISHED)
    java      3030    root   52u  IPv6  20855       TCP 192.168.0.31:8009->192.168.0.24:57768 (ESTABLISHED)



    Tomcat2 (192.168.0.32)

    포트 사용 내역 확인


    [root@localhost ROOT]# lsof -i
    java      3004    root   42u  IPv6  19703       TCP *:8009 (LISTEN)
    java      3004    root   43u  IPv6  19704       TCP 192.168.0.32:8009->192.168.0.24:59781 (ESTABLISHED)
    java      3004    root   44u  IPv6  19707       TCP localhost.localdomain:8005 (LISTEN)
    java      3004    root   46u  IPv6  22024       TCP 192.168.0.32:8009->192.168.0.24:59782 (ESTABLISHED)

    댓글목록

    등록된 댓글이 없습니다.