본문 바로가기

WAS/WebLogic

start / stop script


# 테스트 환경

  • OS : Oracle Linux Server release 8.6
  • JDK : 1.8
  • WebLogic ver. : 12cR2

# start script

- startA.sh

USER_NAME=
SERVER_NAME=AdminServer
SERVER_PORT=7001
DOMAIN_HOME=
DOAMIN_NAME=
BOOT_PROPERTIES=${DOMAIN_HOME}/boot.properties
LOG_DIR=${DOMAIN_HOME}/logs/${SERVER_NAME}
GC_LOG_DIR=${LOG_DIR}/gc
LOG_TIME=`date +%y%m%d_%H%M`
 
# Check User Name
IAM=`id -un`
# Check Startup User Check
if [ $USER_NAME != $IAM ] ; then
 echo "Error : This user is \"$IAM\". Please login as a \"$USER_NAME\"
user."
 exit
fi

# Check Process Check
PID=`ps -ef | grep java | grep ${SERVER_NAME} | grep ${SERVER_PORT} | awk '{print $2}'`
if [ "$PID" != "" ] ; then
 echo "ERROR : \"${SERVER_NAME}\" server is already running!!"
 exit
fi

##gc log rotation##
USER_MEM_ARGS="${USER_MEM_ARGS} -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:${GC_LOG_DIR}/gc_${SERVER_NAME}.out"
mv ${GC_LOG_DIR}/gc_${SERVER_NAME}.out ${GC_LOG_DIR}/gc_${SERVER_NAME}.out.${LOG_TIME}
###################

##heap dump##
USER_MEM_ARGS="${USER_MEM_ARGS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_DIR}/heapdump"
#############

USER_MEM_ARGS="${USER_MEM_ARGS} -Xms1024m -Xmx1024m -XX:MetaspaceSize=512m  -XX:MaxMetaspaceSize=512m"
USER_MEM_ARGS="${USER_MEM_ARGS} -Dweblogic.threadpool.MinPoolSize=200 -Dweblogic.threadpool.MaxPoolSize=400"
USER_MEM_ARGS="${USER_MEM_ARGS} -Dweblogic.wsee.skip.async.response=true -Dserver.name=${SERVER_NAME} -Dserver.port=${SERVER_PORT}"
USER_MEM_ARGS="${USER_MEM_ARGS} -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false"
USER_MEM_ARGS="${USER_MEM_ARGS} -D_Offline_FileDataArchive=true -Dweblogic.connector.ConnectionPoolProfilingEnabled=false -Dcom.bea.wlw.netui.disableInstrumentation=true"
export USER_MEM_ARGS

JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.system.BootIdentityFile=${BOOT_PROPERTIES} -Djava.security.egd=file:/dev/./urandom"
export JAVA_OPTIONS

mv ${LOG_DIR}/${SERVER_NAME}.out ${LOG_DIR}/${SERVER_NAME}.out.${LOG_TIME}
nohup ${DOMAIN_HOME}/bin/startWebLogic.sh > ${LOG_DIR}/${SERVER_NAME}.out 2>&1 &
sleep 1
tail -f ${LOG_DIR}/${SERVER_NAME}.out

 

 

- startM1.sh

USER_NAME=
SERVER_NAME=M1
SERVER_PORT=7002
DOMAIN_HOME=
DOMAIN_NAME=
LOG_DIR=${DOMAIN_HOME}/logs/${SERVER_NAME}
BOOT_PROPERTIES=${DOMAIN_HOME}/boot.properties
GC_LOG_DIR=${LOG_DIR}/gc
ADMIN_URL=t3://192.168.56.210:7001
LOG_TIME=`date +%y%m%d_%H%M`

##mkdir logs##
if [ ! -f $LOG_DIR ]; then
        mkdir -p $LOG_DIR
fi

if [ ! -f $GC_LOG_DIR ]; then
        mkdir -p $GC_LOG_DIR
fi

# Check User Name
IAM=`id -un`
# Check Startup User Check
if [ $USER_NAME != $IAM ] ; then
 echo "Error : This user is \"$IAM\". Please login as a \"$USER_NAME\" user."
 exit
fi

# Check Process Check
PID=`ps -ef | grep java | grep ${SERVER_NAME} | grep ${SERVER_PORT} | awk '{print $2}'`
if [ "$PID" != "" ] ; then
echo "ERROR : \"${SERVER_NAME}\" server is already running!!"
 exit
fi

##### gc log rotation #####
USER_MEM_ARGS="${USER_MEM_ARGS} -verbose:gc -Xloggc:${GC_LOG_DIR}/gc_${SERVER_NAME}.out"
mv ${GC_LOG_DIR}/gc_${SERVER_NAME}.out ${GC_LOG_DIR}/gc_${SERVER_NAME}.out.${LOG_TIME}
######################

##### heap dump #####
USER_MEM_ARGS="${USER_MEM_ARGS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_DIR}/heapdump"
######################

USER_MEM_ARGS="${USER_MEM_ARGS} -Xms1024m -Xmx1024m -XX:MetaspaceSize=512m  -XX:MaxMetaspaceSize=512m"
USER_MEM_ARGS="${USER_MEM_ARGS} -Dweblogic.threadpool.MinPoolSize=200 -Dweblogic.threadpool.MaxPoolSize=400"
USER_MEM_ARGS="${USER_MEM_ARGS} -Dweblogic.wsee.skip.async.response=true -Dserver.name=${SERVER_NAME} -Dserver.port=${SERVER_PORT}"
USER_MEM_ARGS="${USER_MEM_ARGS} -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false"
USER_MEM_ARGS="${USER_MEM_ARGS} -D_Offline_FileDataArchive=true -Dweblogic.connector.ConnectionPoolProfilingEnabled=false -Dcom.bea.wlw.netui.disableInstrumentation=true"
export USER_MEM_ARGS

JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.system.BootIdentityFile=${BOOT_PROPERTIES} -Djava.security.egd=file:/dev/./urandom"
export JAVA_OPTIONS

mv ${LOG_DIR}/${SERVER_NAME}.out ${LOG_DIR}/${SERVER_NAME}.out.${LOG_TIME}
nohup ${DOMAIN_HOME}/bin/startManagedWebLogic.sh ${SERVER_NAME} ${ADM_URL} > ${LOG_DIR}/${SERVER_NAME}.out 2>&1 &
sleep 1
tail -f $LOG_DIR/$SERVER_NAME.out

 

# stop script

- stop.py

connect(url=sys.argv[1])
shutdown(force='true')
exit()

 

 

- stopA.sh

SERVER_URL=t3://SERVER_IP:ADMIN_SERVER_PORT
. ./bin/setDomainEnv.sh
java weblogic.WLST stop.py ${SERVER_URL}

 

 

- stopM1.sh

SERVER_URL=t3://SERVER_IP:INSTANCE_SERVER_PORT
. ./bin/setDomainEnv.sh
java weblogic.WLST stop.py ${SERVER_URL}

 

 

# 주의 사항

WebLogic 11g 와 12c에서 사용하는 script에는 차이점이 존재

 

11g → 주로 jdk 1.7을 사용

USER_MEM_ARGS="${USER_MEM_ARGS} -Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=512M -verbose:gc"

 

메모리 설정 부분에서 jdk 1.7은 PermSize를 사용

 

 

12c → 주로 jdk 1.8을 사용

USER_MEM_ARGS="${USER_MEM_ARGS} -Xms1024m -Xmx1024m -XX:MetaspaceSize=512m  -XX:MaxMetaspaceSize=512m"

 

jdk 1.7에서 1.8로 넘어오며 Permanent Generation 메모리 영역이 없어지고 Metaspace 영역이 새로 생김

 

따라서 1.8에서는 PermSize가 아닌 MetaspaceSize 태그를 사용

'WAS > WebLogic' 카테고리의 다른 글

Application 이슈 있을 때 확인 사항  (0) 2024.09.23
WebLogic Admin ID/PW 변경 및 복호화  (1) 2024.07.16
WebLogic Log 설정  (1) 2024.07.12
boot.properties 암호화  (0) 2024.07.12
WebLogic 12.2.1.4 설치 가이드  (1) 2024.07.12