[Oracle]Part 3)쉽고 완벽한 Weblogic과 Webtier 설치하기
일반적으로 Oracle WebLogic Server(wls)는 Java EE 애플리케이션을 실행하고 관리하는 데 사용되며, Oracle Webtier(ohs, Oracle HTTP Server)는 정적 및 동적 웹 콘텐츠를 서비스하고 보안 기능을 제공하여 웹 애플리케이션 환경을 보완합니다. 이 두 제품은 혼합하여 사용되어 Java 애플리케이션을 실행하고 프론트 엔드 웹 서버로부터 요청을 처리하는 효율적인 웹 애플리케이션 스택을 구축하는 데 도움을 줍니다. Oracle Database 11gR2가 설치된 VM(oel7.8)에 wls와 ohs를 설치하도록 하겠습니다.
- Part 1. 설치 준비하기
- Part 2. ohs(Oracle HTTP Server) 설치하기
- Part 3. wls(Weblogic Server) 설치하기
- Part 4. 응용 프로그램 배치
- Part 5. 클러스터 구성
- Part 6. 데이터 소스 연결
1. wls를 silent mode로 설치하기
silent 모드로 설치하기 위해서는 응답 파일(wls_install.rsp)와 Oracle Inventory 위치를 나타내는 파일(wls_oraInst.loc)이 필요합니다. Part 1)에서 생성한 weblogic 사용자로 설치를 진행합니다.
- “wls_install.rsp” 파일 생성하기
-responseFile <파일 경로> 옵션으로 지정하며, silent 모드 설치를 자동화하는 핵심 요소 중 하나입니다. 응답 파일에는 설치 옵션, 구성 정보 및 기타 필요한 설정이 포함됩니다.[weblogic@oel7u8 ~]$ cd /oracle/sw/wls [weblogic@oel7u8 wls]$ vi wls_install.rsp[ENGINE] #DO NOT CHANGE THIS. Response File Version=1.0.0.0.0 [GENERIC] #The oracle home location. This can be an existing Oracle Home or a new Oracle Home #wls의 설치 위치를 지정합니다. ORACLE_HOME=/oracle/fmw/wls/ #Set this variable value to the Installation Type selected. e.g. WebLogic Server, Coherence, Complete with Examples. INSTALL_TYPE=WebLogic Server #MyOracleSupport Account MOS_USERNAME= MOS_PASSWORD=#Set this to true if you wish to skip software updates DECLINE_AUTO_UPDATES=true #Set this to true if you wish to decline the security updates. \ #Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration DECLINE_SECURITY_UPDATES=true #Set this to true if My Oracle Support Password is specified SECURITY_UPDATES_VIA_MYORACLESUPPORT=false - “wls_oraInst.loc” 파일 생성하기
[weblogic@oel7u8 wls]$ vi wls_oraInst.locinventory_loc=/oracle/oraInventory/wls inst_group=weblogic
- silent mode로 wls 설치하기
[weblogic@oel7u8 wls]$ /oracle/sw/jdk1.7.0_80/bin/java -jar ./fmw_12.1.3.0.0_wls.jar -silent \ > -responseFile /oracle/sw/wls/wls_install.rsp \ > -invPtrLoc /oracle/sw/wls/wls_oraInst.locLauncher log file is /tmp/OraInstall2023-09-16_02-05-09AM/launcher2023-09-16_02-05-09AM.log. Extracting files...... Starting Oracle Universal Installer Checking if CPU speed is above 300 MHz. Actual 2111.998 MHz Passed Checking swap space: must be greater than 512 MB. Actual 4063228 MB Passed Checking if this platform requires a 64-bit JVM. Actual 64 Passed (64-bit not required) Checking temp space: must be greater than 300 MB. Actual 10387 MB Passed Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2023-09-16_02-05-09AM Log: /tmp/OraInstall2023-09-16_02-05-09AM/install2023-09-16_02-05-09AM.log Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. Reading response file.. Starting check : CertifiedVersions Expected result: One of enterprise-4,enterprise-5,enterprise-6,redhat-6,redhat-4,redhat-5,SuSE-11 Actual Result: redhat-7.8 Check complete. The overall result of this check is: Failed <<<< Problem: This Oracle software is not certified on the current operating system. Recommendation: Make sure you are installing the software on the correct platform. Warning: Check:CertifiedVersions failed. Starting check : CheckJDKVersion Expected result: 1.7.0_15 Actual Result: 1.7.0_80 Check complete. The overall result of this check is: Passed CheckJDKVersion Check: Success. Validations are enabled for this session. Verifying data...... Copying Files... You can find the log of this install session at: /tmp/OraInstall2023-09-16_02-05-09AM/install2023-09-16_02-05-09AM.log -----------20%----------40%----------60%----------80%--------100% The installation of Oracle Fusion Middleware 12c WebLogic Server and Coherence 12.1.3.0.0 completed successfully. Logs successfully copied to /oracle/oraInventory/logs.
2. 도메인(Domain) 생성하기
WebLogic Server에서 "도메인(Domain)"은 일종의 관리 단위로, 여러 서버와 어플리케이션을 그룹화하고 구성 관리를 통합하는 논리적인 단위입니다. WebLogic Server 도메인은 WebLogic Server 인스턴스들을 포함하며, 이들 인스턴스는 특정 네트워크와 데이터베이스 리소스에 액세스하고, 특정 어플리케이션을 호스팅하게 됩니다.
- 도메인 생성을 위한 스크립트 파일(wls_domain.py) 작성
[weblogic@oel7u8 wls]$ vi wls_domain.pyreadTemplate('/oracle/fmw/wls/wlserver/common/templates/wls/wls.jar'); setOption('JavaHome','/oracle/sw/jdk1.7.0_80'); setOption('ServerStartMode','prod'); cd('Security/base_domain/User/weblogic'); set('Name', 'weblogic'); cmo.setPassword('oracle1234'); cd('Servers/AdminServer'); set('Name','AdminServer'); set('ListenAddress', '192.168.56.104'); set('ListenPort',7100); cd('/'); writeDomain('/oracle/fmw/wls/domains/orcl_domain'); closeTemplate(); exit();
- WebLogic Scripting Tool(wlst.sh)를 이용하여 도메인 생성
WLST는 WebLogic Server 도메인을 자동화하고 관리하기 위해 사용되는 강력한 도구로, Python 스크립트 언어를 기반으로 하며 WebLogic Server의 모든 기능을 스크립트를 통해 제어할 수 있습니다.[weblogic@oel7u8 wls]$ cd /oracle/fmw/wls/wlserver/common/bin [weblogic@oel7u8 bin]$ lltotal 92 -rwxr-x--- 1 weblogic weblogic 483 Feb 6 2013 clonedunpack.sh -rwxr-x--- 1 weblogic weblogic 209 Mar 1 2012 commEnv.sh -rwxr-x--- 1 weblogic weblogic 487 Mar 1 2012 config_builder.sh -rwxr-x--- 1 weblogic weblogic 471 Dec 19 2012 config.sh -rwxr-x--- 1 weblogic weblogic 467 Dec 19 2012 pack.sh -rwxr-x--- 1 weblogic weblogic 491 Apr 16 2012 prepareCustomProvider.sh -rwxr-x--- 1 weblogic weblogic 736 Feb 7 2013 qs_config.sh -rwxr-x--- 1 weblogic weblogic 473 Mar 1 2012 reconfig.sh -rwxr-x--- 1 weblogic weblogic 471 Dec 19 2012 unpack.sh -rwxr-x--- 1 weblogic weblogic 33519 Sep 16 02:06 wlscontrol.sh -rwxr-x--- 1 weblogic weblogic 16286 May 21 2014 wlsifconfig.sh -rwxr-x--- 1 weblogic weblogic 1748 Dec 19 2012 wlst.sh[weblogic@oel7u8 bin]$ ./wlst.sh /oracle/sw/wls/wls_domain.pyInitializing WebLogic Scripting Tool (WLST) ... Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away. Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands Exiting WebLogic Scripting Tool. - Weblogic 프로세스를 Background(&)로 실행하기
wls_domain.py 파일에 설정한 Weblogic 관리자 계정(weblogic) 및 비밀번호(oracle1234) 입력 필요[weblogic@oel7u8 bin]$ cd /oracle/fmw/wls/domains/orcl_domain [weblogic@oel7u8 orcl_domain]$ ./startWebLogic.sh &. . JAVA Memory arguments: -Xms256m -Xmx512m -XX:MaxPermSize=256m ...... *************************************************** * To start WebLogic Server, use a username and * * password assigned to an admin-level user. For * * server administration, use the WebLogic Server * * console at http://hostname:port/console * *************************************************** ...... Enter username to boot WebLogic server:"weblogic" Enter password to boot WebLogic server:"oracle1234" ...... <Sep 16, 2023 2:23:08 AM KST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.> <Sep 16, 2023 2:23:08 AM KST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.> - Weblogic 웹 콘솔 접속 테스트(http://192.168.56.104:7100/console/)
"wls_domain.py"에 등록된 IP주소 및 Port로 접속합니다.
3. Weblogic 웹 콘솔에서 Managed Server 생성하기
- "환경 > 서버" 메뉴 클릭 → "잠금 및 편집" 버튼 클릭 → "새로 만들기" 버튼 클릭
- "서버 이름"과 "서버 수신 포트" 입력 후 "완료" 버튼 클릭
- 동일한 방법으로 "Server2"로 생성한 후 "변경 내용 활성화" 버큰 클릭
- Weblogic 프로세스 인터럽트(ctrl+c) 및 웹 콘솔 설정 결과 확인
^C[weblogic@oel7u8 orcl_domain]$ cd config/ [weblogic@oel7u8 config]$ vi config.xml..... <server> <name>AdminServer</name> <listen-port>7100</listen-port> <listen-address>192.168.56.104</listen-address> </server> <server> <name>Server1</name> <listen-port>7101</listen-port> <web-server> <web-server-log> <number-of-files-limited>false</number-of-files-limited> </web-server-log> </web-server> <listen-address></listen-address> </server> <server> <name>Server2</name> <listen-port>7102</listen-port> <web-server> <web-server-log> <number-of-files-limited>false</number-of-files-limited> </web-server-log> </web-server> <listen-address></listen-address> </server> .....
4. AdminServer background 실행 및 중지 스크립트 작성
- AdminSever 실행 스크립트 작성
[weblogic@oel7u8 config]$ mkdir ../scripts/; cd ../scripts [weblogic@oel7u8 scripts]$ vi startAdminServer.sh############################################################################################### # DeFault_info # ############################################################################################### DOMAIN_HOME=/oracle/fmw/wls/domains DOMAIN_NAME=orcl_domain DOMAIN=$DOMAIN_HOME/$DOMAIN_NAME USER=weblogic SERVER_NAME=AdminServer BOOT_PROPERTIES=${DOMAIN}/boot.properties TIME=`date +%y%m%d_%H%M` LOG_DIR=${DOMAIN}/servers/${SERVER_NAME}/logs ############################################################################################### # PS_Check # ############################################################################################### NM_PID=`ps -ef | grep $SERVER_NAME | grep -w "Dweblogic.Name" | awk '{print $2}'` if [ -z $NM_PID ]; then echo "$SERVER_NAME is not running!!!" echo "Start $SERVER_NAME" else echo "$SERVER_NAME PID is $NM_PID" echo "$SERVER_NAME is already running!!!" exit fi ############################################################################################### # User_check # ############################################################################################### CHECK=`id -un` if [ ${USER} != ${CHECK} ]; then echo " ** You do not have permission ! **" echo " Stop WebLogic " exit; fi ############################################################################################### # Make_Log_Dir # ############################################################################################### # #if [ ! -f $LOG_DIR ]; then #mkdir -p $LOG_DIR #fi #mv ${LOG_DIR}/${SERVER_NAME}.out ${LOG_DIR}/${SERVER_NAME}.out.${TIME} ############################################################################################### # JAVA_OPTIONS # ############################################################################################### #JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.system.BootIdentityFile=${BOOT_PROPERTIES}" #JAVA_OPTIONS="${JAVA_OPTIONS} -Xms1024m -Xmx1024m" #export JAVA_OPTIONS export USER_MEM_ARGS=" -DAdminServer -Xms1024m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m -Dweblogic.system.BootIdentityFile=${BOOT_PROPERTIES}" nohup ${DOMAIN}/bin/startWebLogic.sh > ${LOG_DIR}/${SERVER_NAME}.out 2>&1 & sleep 1 tail -f ${LOG_DIR}/${SERVER_NAME}.out
- AdminServer 중지 스크립트 작성
[weblogic@oel7u8 scripts]$ vi stopAdminServer.sh############################################################################################### # DeFault_info # ############################################################################################### DOMAIN_HOME=/oracle/fmw/wls/domains DOMAIN_NAME=orcl_domain DOMAIN=$DOMAIN_HOME/$DOMAIN_NAME STOP=$DOMAIN/scripts/stop.py LISTENADDRESS="192.168.56.104" LISTENPORT="7100" ############################################################################################### # AdminServer_Stop # ######################### ##################################################################### . $DOMAIN/bin/setDomainEnv.sh java weblogic.WLST $STOP t3://${LISTENADDRESS}:${LISTENPORT}
- “stop.py” 파일 생성
[weblogic@oel7u8 scripts]$ vi stop.pyconnect(url=sys.argv[1]) shutdown(force='true') exit()
- 사용자/비밀번호 관리 파일(boot.properties) 생성
[weblogic@oel7u8 scripts]$ vi ../boot.propertiesusername=weblogic password=oracle1234
- 스크립트 파일 실행권한 부여 및 AdminServer 프로세스 실행 후 웹 콘솔 접속
[weblogic@oel7u8 scripts]$ chmod 750 startAdminServer.sh [weblogic@oel7u8 scripts]$ chmod 750 stopAdminServer.sh [weblogic@oel7u8 scripts]$ ./startAdminServer.sh
5. Managed Server(Server1/Server2) background 실행 및 중지 스크립트 작성
- Server1 background 실행 스크립트 작성
[weblogic@oel7u8 scripts]$ vi startServer1.sh############################################################################################### # DeFault_info # ############################################################################################### export DOMAIN_HOME=/oracle/fmw/wls/domains export DOMAIN_NAME=orcl_domain export DOMAIN=$DOMAIN_HOME/$DOMAIN_NAME export USER=weblogic export SERVER_NAME=Server1 export SERVER_PORT=7101 export ADMIN_URL="192.168.56.104:7100" export BOOT_PROPERTIES=${DOMAIN}/boot.properties TIME=`date +%y%m%d_%H%M` LOG_DIR=${DOMAIN}/servers/${SERVER_NAME}/logs ############################################################################################### # PS_Check # ############################################################################################### NM_PID=`ps -ef | grep $SERVER_NAME | grep -w "Dweblogic.Name" | awk '{print $2}'` if [ -z $NM_PID ]; then echo "$SERVER_NAME is not running!!!" echo "Start $SERVER_NAME" else echo "$SERVER_NAME PID is $NM_PID" echo "$SERVER_NAME is already running!!!" exit fi ############################################################################################### # User_check # ############################################################################################### CHECK=`id -un` if [ ${USER} != ${CHECK} ]; then echo " ** You do not have permission ! **" echo " Stop WebLogic " exit; fi ############################################################################################### # Make_Log_Dir # ############################################################################################### if [ ! -f $LOG_DIR ]; then mkdir -p $LOG_DIR fi mv ${LOG_DIR}/${SERVER_NAME}.out ${LOG_DIR}/${SERVER_NAME}.out.${TIME} ############################################################################################### # JAVA_OPTIONS # ############################################################################################### #JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.system.BootIdentityFile=${BOOT_PROPERTIES}" #JAVA_OPTIONS="${JAVA_OPTIONS} -Xms1024m -Xmx1024m" #export JAVA_OPTIONS export USER_MEM_ARGS="" USER_MEM_ARGS=" -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$DOMAIN/DUMP/$SERVER_NAME/ ${USER_MEM_ARGS}" export USER_MEM_ARGS=" -D${SERVER_NAME} -Xms1024m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m -Dweblogic.system.BootIdentityFile=${BOOT_PROPERTIES} ${USER_MEM_ARGS}" nohup ${DOMAIN}/bin/startWebLogic.sh > ${LOG_DIR}/${SERVER_NAME}.out 2>&1 & sleep 1 tail -f ${LOG_DIR}/${SERVER_NAME}.out
- Server1 중지 스크립트 작성
[weblogic@oel7u8 scripts]$ vi stopServer1.sh############################################################################################### # DeFault_info # ############################################################################################### export DOMAIN_HOME=/oracle/fmw/wls/domains export DOMAIN_NAME=orcl_domain export DOMAIN=$DOMAIN_HOME/$DOMAIN_NAME STOP=$DOMAIN/scripts/stop.py LISTENADDRESS="192.168.56.104" LISTENPORT="7101" ############################################################################################### # ManagedServer_Stop # ######################### ##################################################################### . $DOMAIN/bin/setDomainEnv.sh java weblogic.WLST $STOP t3://${LISTENADDRESS}:${LISTENPORT}
- Server2 background 실행/중지 스크립트 추가 작성 및 실행 권한 부여
[weblogic@oel7u8 scripts]$ chmod 750 * [weblogic@oel7u8 scripts]$ lltotal 28 -rwxr-x---. 1 weblogic weblogic 2723 Oct 12 08:40 startAdminServer.sh -rwxr-x---. 1 weblogic weblogic 2981 Oct 12 09:42 startServer1.sh -rwxr-x---. 1 weblogic weblogic 2981 Oct 12 09:44 startServer2.sh -rwxr-x---. 1 weblogic weblogic 852 Oct 12 09:54 stopAdminServer.sh -rwxr-x---. 1 weblogic weblogic 55 Sep 26 07:21 stop.py -rwxr-x---. 1 weblogic weblogic 852 Sep 26 07:24 stopServer1.sh -rwxr-x---. 1 weblogic weblogic 852 Sep 26 07:28 stopServer2.sh
- Managed Server(Server1/Server2) background 실행 및 확인
[weblogic@oel7u8 scripts]$ ./startServer1.shServer1 is not running!!! Start Server1 * console at http://hostname:port/console * *************************************************** ..... MORE ..... <Oct 12, 2023 11:37:24 AM KST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>^C[weblogic@oel7u8 scripts]$ ./startServer2.shServer2 is not running!!! Start Server2 *************************************************** ..... MORE ..... <Oct 12, 2023 11:38:27 AM KST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>
6. 상태 체크 스크립트 작성 및 실행
- 상태 체크 스크립트 작성
Daily Health Check Script에 추가하면 주기적으로 Weblogic의 상태를 점검할 수 있습니다.[weblogic@oel7u8 orcl_domain]$ vi wls_status.py#connect([username],[password],[admin url]) connect('weblogic','oracle1234','t3://192.168.56.104:7100') servers=cmo.getServers() print "-------------------------------------------------------" print "\t"+cmo.getName()+" domain status" print "-------------------------------------------------------" for server in servers: state(server.getName(),server.getType()) print "-------------------------------------------------------"[weblogic@oel7u8 orcl_domain]$ vi wls_status.sh/oracle/fmw/wls/oracle_common/common/bin/wlst.sh /oracle/fmw/wls/domains/orcl_domain/wls_status.py 2>&1[weblogic@oel7u8 orcl_domain]$ chmod 750 ./wls_status.sh - 상태 체크 스크립트 실행
[weblogic@oel7u8 orcl_domain]$ ./wls_status.shInitializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands Connecting to t3://192.168.56.104:7100 with userid weblogic ... Successfully connected to Admin Server "AdminServer" that belongs to domain "orcl_domain". Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead. ------------------------------------------------------- orcl_domain domain status ------------------------------------------------------- Current state of "AdminServer" : RUNNING Current state of "Server1" : RUNNING Current state of "Server2" : RUNNING -------------------------------------------------------