반응형

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 기동 및 서비스 점검

wokers..properties에 worker.xxx.fail_on_status=503 설정 추가

각 node에 설정하거나, templete에 설정

workers.properties
#worker.list=jk-status
#worker.jk-status.type=status
#worker.jk-status.read_only=true
 
#worker.list=jk-manager
#worker.jk-manager.type=status
 
worker.list=balancer
worker.balancer.type=lb
worker.balancer.balance_workers=node1,node2
worker.balancer.error_escalation_time=0
worker.balancer.max_reply_timeouts=10
worker.balancer.sticky_session=true
#worker.balancer.method=Session
 
worker.node1.reference=worker.template
worker.node1.host=192.168.0.112
worker.node1.port=9109
worker.node1.route=test_server11
worker.node1.activation=A
worker.node1.fail_on_status=503
 
worker.node2.reference=worker.template
worker.node2.host=192.168.0.112
worker.node2.port=9209
worker.node2.route=test_server12
worker.node2.activation=A
worker.node2.fail_on_status=503
 
worker.template.type=ajp13
worker.template.socket_connect_timeout=5000
worker.template.socket_keepalive=true
worker.template.ping_mode=A
worker.template.ping_timeout=10000
worker.template.connection_pool_minsize=0
worker.template.connection_pool_timeout=600
worker.template.reply_timeout=300000
worker.template.recovery_options=3
#worker.template.fail_on_status=503

 

Wildfly, Jboss 연동 시 세션 중복처리가 가능한 상태로 설정해야 한다.

 

standalone-ha.xml

(변경 전)

standalone-ha.xml
<subsystem xmlns="urn:jboss:domain:infinispan:7.0">
   <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
        <transport lock-timeout="60000"/>
        <distributed-cache name="dist">
            <locking isolation="REPEATABLE_READ"/>
            <transaction mode="BATCH"/>
            <file-store/>
        </distributed-cache>
    </cache-container>

 

(변경 후 - locking isolation, transaction mode 태그 삭제)

standalone-ha.xml
<subsystem xmlns="urn:jboss:domain:infinispan:7.0">
    <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
        <transport lock-timeout="60000"/>
        <distributed-cache name="dist">
            <file-store/>
        </distributed-cache>
    </cache-container>

 

'IT기술노트 > WEB' 카테고리의 다른 글

Windows Apache 설치  (4) 2024.10.31
Linux Apache 컴파일 설치(CentOS7)  (2) 2024.10.31
Apache/Jbcs 서버 헤더 변경 방법  (3) 2024.10.31
Nginx 설치 테스트(ubuntu20.04)  (2) 2024.10.29
Nginx SSL 인증서 설정 방법  (2) 2024.10.29

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>​

 

+ Recent posts