'제우스'에 해당되는 글 1

  1. 2011.12.16 JEUS 설정관련 - DB Connection 등. 1
카테고리 없음 | Posted by 낫기법필 2011. 12. 16. 16:04

JEUS 설정관련 - DB Connection 등.

Servlet 컨테이너 만들기
    1. tmaxeduC18_servlet_engine1 폴더 복사 tmaxeduC18_servlet_engine3


    2. JEUSMain.xml 에서 container 설정 부분에 아래 부분 추가
        <engine-container>
            <name>container3</name>
            <engine-command>
                <type>servlet</type>
                <name>engine3</name>
            </engine-command>
        </engine-container>

        1) 설정시  <id>76</id><base-port>10511</base-port> 제거하면 jeus에서 알아서 해당 코드를 만들게 됨


    3. C:\TmaxSoft\JEUS5\config\tmaxeduC18\tmaxeduC18_servlet_engine3\WEBMain.xml 수정
        1) webtob 설정에서 container 에서 사용중인 Thread개수 만큼 connection 개수를 늘려주어야 한다.
        2) 아래와 같이 port 부분을 충돌나지 않게 변경해 준다.
            <http-listener>
                <listener-id>http1</listener-id>
                <port>9000</port>
                <thread-pool>
                    <min>10</min>
                    <max>20</max>
                    <step>1</step>
                </thread-pool>
            </http-listener>


    4. Container에서 사용하는 메모리 설정(command-option에서)
        <engine-container>
            <name>container3</name>
            <command-option>-Xms128m -Xmx128m</command-option>
            <engine-command>
                <type>servlet</type>
                <name>engine3</name>
            </engine-command>
        </engine-container>

 

    5. 기동 후 container 기동 확인
        C:\Documents and Settings\edu>ja

        C:\Documents and Settings\edu>jeusadmin tmaxeduC18 -Uadministrator -Pjeusadmin
        JEUS 5.0 (fix #27) Jeus Manager Controller
        tmaxeduC18>conlist
        container list of the node tmaxeduC18
                tmaxeduC18_container3
                tmaxeduC18_container2
                tmaxeduC18_container1
        tmaxeduC18>

 

ejb engine 추가하기
    1. tmaxeduC18_ejb_engine1 를 tmaxeduC18_ejb_engine2 로 복사

 

    2. container 부분에 ejb engine 추가
        <engine-container>
            <name>container3</name>
            <command-option>-Xms128m -Xmx128m</command-option>
            <engine-command>
                <type>ejb</type>
                <name>engine2</name>
            </engine-command>
            <engine-command>
                <type>servlet</type>
                <name>engine3</name>
            </engine-command>
        </engine-container>

 

    3. container 만 재 기동 하기
      1) JEUSMain.xml 을 변경시 jeus main 관련 설정은 자동 변경된다.
            - 아래와 같이 재 기동 이후에 설정내용이 반영된다.

        C:\Documents and Settings\edu>ja
        C:\Documents and Settings\edu>jeusadmin tmaxeduC18 -Uadministrator -Pjeusadmin
        JEUS 5.0 (fix #27) Jeus Manager Controller
        tmaxeduC18>conlist
        container list of the node tmaxeduC18
                tmaxeduC18_container3
                tmaxeduC18_container2
                tmaxeduC18_container1
        tmaxeduC18>downcon tmaxeduC18_container3
        tmaxeduC18_container3 container down successful
        tmaxeduC18>startcon tmaxeduC18_container3
        tmaxeduC18_container3 container started successfully

 

    4. ejb 추가 내용 확인
        tmaxeduC18>englist
        ========================================
        engines in the container tmaxeduC18_container1
        tmaxeduC18_ws_engine1
        tmaxeduC18_jms_engine1
        tmaxeduC18_ejb_engine1
        tmaxeduC18_servlet_engine1
        ========================================
        ========================================
        engines in the container tmaxeduC18_container2
        tmaxeduC18_servlet_engine2
        ========================================
        ========================================
        engines in the container tmaxeduC18_container3
        tmaxeduC18_ejb_engine2
        tmaxeduC18_servlet_engine3
        ========================================


application 목록 확인
        tmaxeduC18>applist
        name : examples
                type : J2EEApplication  EngineContainer : tmaxeduC18_container1 node : tmaxeduC18       state : running
        name : garasani-web
                type : WebModule        EngineContainer : tmaxeduC18_container1 node : tmaxeduC18       state : running
        name : exploded
                type : WebModule        EngineContainer : tmaxeduC18_container1 node : tmaxeduC18       state : running


DataSource 설정
    1. 데이터 소스 설정
        1) Thin : JDBC Driver 자체에 Connection 등이 모두 java로 구현한 방법
            - ojdbc14.jar 파일만 위치시키면됨
        2) OCI  : Native Driver를 이용하여 접근
            - 속도가 이것이 더 빠름
            - Oracle Client를 설치해야 한다.

 

    2. 아래의 경로에 jdbc library 파일을 복사한다.
        C:\TmaxSoft\JEUS5\lib\datasource

 

    3. Thread Pool 지정
        Period : 동안 사용하지 않으면 connection 맺은 것을 줄여준다.
        Max Use Count : Connection 을 몇번 사용할 것인가를 설정
        Check Query : SQL 을 날리기 전에 check query를 날린 후 처리
        Check Query Period : 주기적으로 check query를 날려준다.
        Stmt Caching Size : Statement를 caching 하므로써 성능을 높여준다.

        Enable Wait : Connection Pool을 모두 사용중일때 대기를 할 것인지 말것인지 설정

 

    4. 생성된 DataSource 확인
        datasource.jsp 사용

 

    5. 설치내용
    <resource>
        <data-source>
            <database>
                <vendor>oracle</vendor>
                <export-name>datasource1</export-name>
                <data-source-class-name>oracle.jdbc.pool.OracleConnectionPoolDataSource</data-source-class-name>
                <data-source-type>ConnectionPoolDataSource</data-source-type>
                <database-name>XE</database-name>
                <port-number>1521</port-number>
                <server-name>127.0.0.1</server-name>
                <user>garasani</user>
                <password>garasani</password>
                <driver-type>thin</driver-type>
                <connection-pool>
                    <pooling>
                        <min>2</min>
                        <max>10</max>
                        <step>1</step>
                        <period>3600000</period>
                    </pooling>
                    <wait-free-connection>
                        <enable-wait>true</enable-wait>
                    </wait-free-connection>
                </connection-pool>
            </database>
        </data-source>
    </resource>

 

    6. container에서 연결해서 사용중인 datasource 확인
        1) 엔진컨테이너 -> hostname_container1 -> 리소스 -> jdbc
            - 여기서 close 안된 connection의 개수를 확인 가능하다.


        2) connection 누수 방지 방법
            Invocation Manager에서 AutoClose 하면 된다.
            - 엔진 컨테이너 -> container 명 -> 설정 -> 기타
                Invocation Manager Action 에서 AutoClose 선택 후 확인
                엔진 재기동
            - 누수가 발생하면 아래와 같이 해당 경로가 나온다.
                [2010.05.06 13:59:52][1][0_576] [container1-16] [MGR-0396] Resources are not closed after use: [JeusConnection[ID=datasource1-1,actual=oracle.jdbc.driver.LogicalConnection@11b315c]]
                [2010.05.06 13:59:52][0][0_576] [container1-16] [MGR-0107] RequestURI : /garasani/datasource.jsp
                [2010.05.06 13:59:52][2][0_576] [container1-16] [MGR-0410] Close JDBC connection[JeusConnection[ID=datasource1-1,actual=oracle.jdbc.driver.LogicalConnection@11b315c]] which is not closed after use

 

        3) JEUSMain.xml에 추가되는 설정 내용
            <invocation-manager-action>AutoClose</invocation-manager-action>

 



[출처] http://blog.naver.com/jadefan?Redirect=Log&logNo=70045626333