반응형

1.$TOMCAT/conf/tomcat-user.xml 파일 수정

 -역할(Role) 및 사용자 계정(user) 추가. 계정/패스워드는 원하는 값으로 설정하시면 됩니다.

<?xml version="1.0" encoding="UTF-8"?>
...
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->


<role rolename="manager-gui"/>
<user username="tomcat" password="password1!" roles="manager-gui"/>



</tomcat-users>

 

2.$TOMCAT/webapps/manager/META-INF/context.xml 수정

 -클라이언트 IP로 접속 가능하게 하려면 org.apache.catalina.valves.RemoteAddrValve 태그는 주석처리 합니다.

<?xml version="1.0" encoding="UTF-8"?>
...
<Context antiResourceLocking="false" privileged="true" >
<!--
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->

  <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context> 

 

3.Tomcat 기동

$TOMCAT/bin/startup.sh

브라우저 접속(http://ip:8080/manager)

관리자 페이지접속 화면

 

1.standalone.conf JAVA_OPTS 변수 또는 start 스크립트에 아래 설정 추가

-Dlog4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator

 

2.module 설정

 ...modules/net/sf/log4jdbc/main/log4jdbc-log4j2-jdbc4-1.12.jar
 ...modules/net/sf/log4jdbc/main/module.xml

module.xml

<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="net.sf.log4jdbc">
    <resources>
        <resource-root path="log4jdbc-log4j2-jdbc4-1.12.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="org.slf4j"/>
        <module name="com.h2database.h2"/>
        <module name="com.oracle"/>
        <module name="org.mariadb"/>
    </dependencies>
</module>

(com.oracle - Orlacle jdbc-dirver  / org.mariadb - mariadb driver)

 

3.standalone*.xml 설정

......
        <subsystem xmlns="urn:jboss:domain:datasources:5.0">
            <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:log4jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                    <driver>log4jdbc</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                <datasource jndi-name="java:/OracleDS" pool-name="OracleDS">
                    <connection-url>jdbc:log4jdbc:oracle:thin:@localhost:1521:orcalesid</connection-url>
                    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
                    <driver>log4jdbc</driver>
                    <security>
                        <user-name>test</user-name>
                        <password>test</password>
                    </security>
                    <validation>
                        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
                        <background-validation>true</background-validation>
                        <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
                        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
                    </validation>
                </datasource>
                <datasource jndi-name="java:jboss/datasources/JpetStoreDS" pool-name="jpetstore">
                    <connection-url>jdbc:log4jdbc:mariadb://192.168.0.163:3306/jpetstore</connection-url>
                    <driver>log4jdbc</driver>
                    <security>
                        <user-name>test</user-name>
                        <password>test</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="oracle" module="com.oracle"/>
                    <driver name="mariadb" module="org.mariadb"/>
                    <driver name="log4jdbc" module="net.sf.log4jdbc"/>
                </drivers>
            </datasources>
        </subsystem> 

...... 

 

4.Connection 테스트

 -테스트 환경상 Oracle DB 접속은 불가능하여 Maria DB로 테스트 수행하였습니다.

[standalone@192.168.0.10:10990 /] data-source test-connection-in-pool --name=jpetstore
true
[standalone@ 192.168.0.10:10990 /] data-source test-connection-in-pool --name=ExampleDS
true 


로그화면

2019-11-08 16:25:25,502 INFO  [jdbc.connection] (management-handler-thread - 1) 1. Connection opened
2019-11-08 16:25:25,502 INFO  [jdbc.audit] (management-handler-thread - 1) 1. Connection.new Connection returned
2019-11-08 16:25:25,510 INFO  [jdbc.audit] (management-handler-thread - 1) 1. Connection.getTransactionIsolation() returned 4
2019-11-08 16:25:25,510 INFO  [jdbc.audit] (management-handler-thread - 1) 1. Connection.isReadOnly() returned false
2019-11-08 16:25:25,512 INFO  [jdbc.audit] (management-handler-thread - 1) 1. Connection.getMetaData() returned org.mariadb.jdbc.MariaDbDatabaseMetaData@54d3ea99
2019-11-08 16:25:25,512 INFO  [jdbc.audit] (management-handler-thread - 1) 1. Connection.getMetaData() returned org.mariadb.jdbc.MariaDbDatabaseMetaData@4eaeff49
2019-11-08 16:25:25,512 INFO  [jdbc.audit] (management-handler-thread - 1) 1. Connection.getMetaData() returned org.mariadb.jdbc.MariaDbDatabaseMetaData@42a42903
2019-11-08 16:25:37,122 INFO  [jdbc.connection] (management-handler-thread - 1) 2. Connection opened
2019-11-08 16:25:37,124 INFO  [jdbc.audit] (management-handler-thread - 1) 2. Connection.new Connection returned
2019-11-08 16:25:37,128 INFO  [jdbc.audit] (management-handler-thread - 1) 2. Connection.getTransactionIsolation() returned 2
2019-11-08 16:25:37,128 INFO  [jdbc.audit] (management-handler-thread - 1) 2. Connection.isReadOnly() returned false
2019-11-08 16:25:37,129 INFO  [jdbc.audit] (management-handler-thread - 1) 2. Connection.getMetaData() returned dbMeta0: conn0: url=jdbc:h2:mem:test user=SA
2019-11-08 16:25:37,129 INFO  [jdbc.audit] (management-handler-thread - 1) 2. Connection.getMetaData() returned dbMeta1: conn0: url=jdbc:h2:mem:test user=SA
2019-11-08 16:25:37,130 INFO  [jdbc.audit] (management-handler-thread - 1) 2. Connection.getMetaData() returned dbMeta2: conn0: url=jdbc:h2:mem:test user=SA 

jboss migration 프로그램 다운로드
 https://github.com/wildfly/wildfly-server-migration/releases

 

샘플 구성환경
-----------------------------------------------------------
Jboss 6.4 경로: /SW/jboss/jboss-eap-6.4
Jboss 7.2 경로: /SW/jboss/jboss-eap-7.2
-----------------------------------------------------------

메뉴얼 jboss-server-migration/docs/user-guide/index.html

 

1.jboss 7.2 설치

 /SW/jboss에 jboss-eap-7.2.5.zip 파일 업로드 (Jboss EAP 7.2에서 패치5가 적용된 파일)
 $ cd /SW/jboss
 $ unzip jboss-eap-7.2.5.zip

 

2.마이그레이션 툴 압축 해제 

/SW/jboss에 jboss-server-migration-1.7.0.Final.zip 파일 업로드
 $ unzip jboss-server-migration-1.7.0.Final.zip
 $ cd jboss-server-migration

 

3.마이그레이션 환경파일 수정

vi /SW/jboss/jboss-server-migration/configuration/environment.properties

####### SERVER PATHS
# Jboss EAP 6.4의 정보
server.source.standalone.serverDir=/SW/jboss/jboss-eap-6.4/standalone
server.source.standalone.configDir=/SW/jboss/jboss-eap-6.4/standalone/configuration
# 마이그레이션 환경파일 설정(모두 마이그레이션 할 경우: standalone.xml,standalone-full.xml,standalone-ha.xml,standalone-full-ha.xml)
server.source.standalone.configFiles=standalone.xml

# Jboss EAP 7.2 설치 경로
server.target.standalone.serverDir=/SW/jboss/jboss-eap-7.2/standalone
server.target.standalone.configDir=/SW/jboss/jboss-eap-7.2/standalone/configuration

# deployment 이관
deployments.migrate-deployments.skip=false
 
# 모듈 포함(jdbc 드라이버)
modules.includes=org.mariadb


----------------------------------------------------------------------------------------------------------------

####### SERVER PATHS

# Jboss EAP 6.4의 정보
server.source.standalone.serverDir=/SW/jboss/jboss-eap-6.4/standalone
server.source.standalone.configDir=/SW/jboss/jboss-eap-6.4/standalone/configuration
# 마이그레이션 환경파일 설정(모두 마이그레이션 할 경우: standalone.xml,standalone-full.xml,standalone-ha.xml,standalone-full-ha.xml)
server.source.standalone.configFiles=standalone.xml

# Jboss EAP 7.2 설치 경로
server.target.standalone.serverDir=/SW/jboss/jboss-eap-7.2/standalone
server.target.standalone.configDir=/SW/jboss/jboss-eap-7.2/standalone/configuration

# deployment 이관
deployments.migrate-deployments.skip=false
 
# 모듈 포함(jdbc 드라이버)
modules.includes=org.mariadb

----------------------------------------------------------------------------------------------------------------

 

4.마이그레이션 수행

$ ./jboss-server-migration.sh -e /SW/jboss/jboss-server-migration/configuration/environment.properties -s /SW/jboss/jboss-eap-6.4 -t /SW/jboss/jboss-eap-7.2
----------------------------------------------------------
----  JBoss Server Migration Tool  -----------------------
----------------------------------------------------------Retrieving servers...
 INFO  SOURCE server name: EAP, version: 6.4.0.GA.
 INFO  TARGET server name: JBoss EAP, version: 7.2.5.GA.----------------------------------------------------------
----------------------------------------------------------Server migration starting... INFO  --- Migrating modules requested by environment... INFO  Module org.mariadb:main migrated.Migrate the source's standalone server?
yes/no? yes INFO  --- Migrating standalone server... INFO  No source's standalone content found to migrate. INFO  Source's standalone configurations found: [standalone.xml]Migrate all configurations?
yes/no? yes INFO  Migrating standalone configuration standalone.xml...
 INFO  Unsupported extensions removed: [org.jboss.as.threads]
 INFO  Unsupported subsystems removed: [urn:jboss:domain:threads:1.1]
 INFO  Module com.mariadb:main migrated.
 INFO  Subsystem elytron added.
 INFO  Subsystem web migrated.
 INFO  Subsystem undertow updated.
 INFO  Subsystem infinispan updated.
 INFO  Subsystem ee updated.
 INFO  Subsystem ejb3 updated.
 INFO  Subsystem remoting updated.
 INFO  Subsystem batch-jberet added.
 INFO  Subsystem core-management added.
 INFO  Subsystem request-controller added.
 INFO  Subsystem security-manager added.
 INFO  Subsystem singleton added.
 INFO  Subsystem discovery added.
 INFO  Subsystem ee-security added.
 INFO  Subsystem microprofile-config-smallrye added.
 INFO  Subsystem microprofile-health-smallrye added.
 INFO  Subsystem microprofile-opentracing-smallrye added.
 INFO  HTTP Upgrade Management configured.
 INFO  Socket binding's port expressions added.
 INFO  Security realms migrated.
 INFO  Security realm ApplicationRealm SSL server identity configured.
 INFO  Persistent deployments found: [test_page.war]This tool is not able to assert if persistent deployments found are compatible with the target server, skip persistent deployments migration?
yes/no? no
 INFO  Persistent deployment test_page.war migrated.Migrate the source's managed domain?
yes/no? noServer migration done. INFO
-------------------------------------------------------------------------------------------
 Task Summary
------------------------------------------------------------------------------------------- server ........................................................................... SUCCESS
  modules.migrate-modules-requested-by-user ....................................... SUCCESS
   modules.migrate-modules-requested-by-user.migrate-module(id=org.mariadb:main) .. SUCCESS
  standalone ...................................................................... SUCCESS
   standalone-configurations ...................................................... SUCCESS
    standalone-configuration(source=standalone.xml) ............................... SUCCESS-------------------------------------------------------------------------------------------
 Migration Result: SUCCESS
-------------------------------------------------------------------------------------------

 

5.jboss-eap 6.4의 실행/종료 스크립트 jboss-eap 7.2로 복사 후 환경에 맞게 수정

 

6.Jboss-eap 7.2 기동 및 서비스 점검

K8S 환경에서 prometheus 모니터링이 가능하도록 하려면 아래와 같이 리버스 프록시를 설정해야 한다.
http 포트 8080의 /metrics 호출 시 management 9990의 /metrics 로 전달

Source url Target url
http://$HOSTNAME:8080/metrics http://$HOSTNAME:9990/metrics

 

standalone-ha.xml

...
        <subsystem xmlns="urn:jboss:domain:undertow:12.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="true">
            <buffer-cache name="default"/>
            <server name="default-server">
                <ajp-listener name="ajp" socket-binding="ajp" worker="ajp-worker"/>
                <http-listener name="default" socket-binding="http" no-request-timeout="10000" disallowed-methods="PUT DELETE TRACE OPTIONS" redirect-socket="https" enable-http2="true"/>
                <https-listener name="https" socket-binding="https" ssl-context="applicationSSC" enable-http2="true"/>
                <host name="default-host" alias="localhost">
                    <location name="/" handler="welcome-content"/>
                    <!-- metric url 설정 -->
                    <location name="/metrics" handler="management_proxy"/>
                    <access-log pattern="%{i,X-Forwarded-For} %t %m %s %T %b %D %u %r" directory="${jboss.server.log.dir}" prefix="access_log" suffix=".log"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                    <filter-ref name="stuck"/>
                    <http-invoker http-authentication-factory="application-http-authentication"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config x-powered-by="false"/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
                <!-- reverse proxy hander 설정 -->
                <reverse-proxy name="management_proxy">
                    <host name="metrics" outbound-socket-binding="management" scheme="http" path="/metrics"/>
                </reverse-proxy>
            </handlers>
            <filters>
                <response-header name="server-header" header-name="Server" header-value="_"/>
                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="_"/>
                <expression-filter name="stuck" expression="blocking; stuck-thread-detector(600)"/>
            </filters>
            <application-security-domains>
                <application-security-domain name="other" security-domain="ApplicationDomain"/>
            </application-security-domains>
        </subsystem>


...
    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
        <socket-binding name="http" port="${jboss.http.port:8080}"/>
        <socket-binding name="https" port="${jboss.https.port:8443}"/>
        <socket-binding name="jgroups-mping" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
        <socket-binding name="jgroups-tcp" port="7600"/>
        <socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>
        <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
        <socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
        <socket-binding name="modcluster" multicast-address="${jboss.modcluster.multicast.address:224.0.1.105}" multicast-port="23364"/>
        <socket-binding name="txn-recovery-environment" port="4712"/>
        <socket-binding name="txn-status-manager" port="4713"/>
        <outbound-socket-binding name="mail-smtp">
            <remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
        </outbound-socket-binding>
        <!-- management socket 설정 -->
        <outbound-socket-binding name="management">
            <remote-destination host="${jboss.bind.address.management}" port="9990"/>
        </outbound-socket-binding>
    </socket-binding-group>​

 

weblogic 12c는 GUI환경에서 기본적으로 설치가 가능하며, console에서 설치할 경우 silent를 사용해야 한다.

 1)fmw_12.1.3.0.0_wls.jar과 install.asp 파일을 동일한 경로에 업로드 한다.

 2)install.asp파일의 ORACLE_HOME에 weblogic 엔진을 설치 할 경로를 추가한다.(ORACLE_HOME=/SW/was/weblogic12c)
 
 3)oraInst.loc 파일 작성 (root 계정으로 수행)
   vi /etc/oraInst.loc (아래 2줄 추가)
  ----------------------------------------
  inventory_loc=/SW/Inst_log
  inst_group=weblogic
  ----------------------------------------
  #inventory_loc -> 설치로그 경로
  #inst_group -> 설치 계정 그룹명
 
 4)weblogic 엔진 설치 수행
  java -jar fmw_12.1.3.0.0_wls.jar -silent -responseFile /SW/app/install.rsp (responseFile 절대경로 입력)
  (java -jar fmw_12.1.3.0.0_wls.jar -silent -invPtrLoc /etc/oraInst.loc -responseFile /SW/app/install.rsp -logfile ./wlsInstall.log)
    ※ 사용할 java의 절대경로를 포함하여 입력    
 
 5)도메인 구성
  [엔진경로]/wlserver/common/bin 에 wls_install.sh 파일 업로드 후 실행


  $  sh wls_install.sh
   
   1)Input IpAddress
    -> IP입력
   2)Input ListenPort(Default:7001) 
    -> Port 입력
   3)Input SSLPort(Default:7002)
    -> SSL Port 입력
   4)Input StartMode(dev/prod)
    -> 개발/운영 모드 입력
   5)Input Account
    -> 관리자 ID 입력    
   6)Input Password
    -> 관리자 Password 입력
   7)Input Domain Home
    -> 도메인 설치 경로 입력
    
  6)Weblogic Admin 기동
   [도메인 경로]/bin/startWeblogic.sh

 

install.rsp
0.00MB
wls_install.sh
0.00MB

1. 기동 쉘(Unix)

< startA.sh> 

#!/bin/sh

cd /home/wls/domains/testDomain
DATEPRE=`date +%Y%m%d%H%M%S`
if [[ -a ADminServer.log ]] then
     mv AdminServer.log ./logs/AdminServer/$DATEPRE.log
fi
nohup ./startWeblogic.sh > AdminServer.log & 2>&1


 1) cd ~ [도메인 경로] 입력
 2) logs 디렉토리 생성


2. 기동 스크립트(Windows)
<startA.cmd>

@ECHO OFF
 cd C:\WAS\Weblogic\user_projects\domains\testDomain
set LOG_DIR=C:\WAS\Weblogic\user_projects\domains\testDomain\logs
set DATEPRE=%date:~0,10%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
cd %LOG_DIR%
if EXIT %LOG_DIR%\AdminServer.log ren AdminServer.log
AdminServer .%DATEPRE%.log
cd C:\WAS\Weblogic\user_projects\domains\testDomain
rem ECHO "웹로직 어드민 서버를 start합니다."
start /B startWebLogic.cmd > %LOG_DIR%\AdminServer.log 2>&1

 

+ Recent posts