jboss_eap_general_configuration_script

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
jboss_eap_general_configuration_script [2022/01/03 04:18] koovjboss_eap_general_configuration_script [2025/03/05 07:14] (현재) – [JDK 1.8 이상 버전을 위한 환경파일] koov
줄 61: 줄 61:
  
 ===== jboss.env ===== ===== jboss.env =====
 +
 +==== JDK 1.8 이상 버전을 위한 환경파일 ====
 +
 +<WRAP prewrap>
 +<code vim jboss.env>
 +##################################################
 +# description : JBoss EAP Standalone script
 +# version     : 2.0.0
 +# date        : 2024-12-05
 +# author      : kwlee2@linuxdata.co.kr
 +##################################################
 +DATE=`date "+%Y%m%d_%H%M%S"`
 +UNAME=`id -u -n`
 +
 +JBOSS_USER="jboss"
 +NODE_NAME="sample"
 +
 +##################################################
 +# JBOSS Common Setup
 +##################################################
 +JBOSS_HOME="/app/jboss"
 +
 +SERVER_HOME="$JBOSS_HOME/SERVERS"
 +SERVER_BASE_DIR="$SERVER_HOME/$NODE_NAME"
 +SERVER_BIN_DIR="$SERVER_BASE_DIR/bin"
 +
 +LOG_HOME="$SERVER_BASE_DIR/logs"
 +
 +BIND_ADDR="192.168.0.71"
 +MGNT_ADDR="192.168.0.71"
 +PRIVATE_ADDR="192.168.0.71"
 +UNSECURE_ADDR="127.0.0.1"
 +
 +MULTICAST_ADDR="230.0.0.3"
 +CLUSTER_PASSWD="CHANGEME!!"
 +MESSAGE_ADDR="231.7.10.1"
 +MESSAGE_PORT="9876"
 +
 +MGNT_HTTP_PORT="9990"
 +MGNT_HTTPS_PORT="9993"
 +
 +PORT_OFFSET="0"
 +PORT_AJP="8009"
 +PORT_HTTP="8080"
 +PORT_HTTPS="8443"
 +
 +##################################################
 +# Current Host Setup
 +##################################################
 +GC_TYPE="g1" # "g1", "parallel", "shenandoah", "ZGC"(only jdk 17+)
 +USE_LARGEPAGE="true" # "true", "false" heap size over 2G
 +
 +##################################################
 +# Configration File
 +##################################################
 +SERVER_CONFIG_FILE="standalone-ha.xml"
 +
 +##################################################
 +# Java Version Check
 +JAVA_VER=`java -version 2>&1 | sed 's/.*\?"\(.*\)".*/\1/; 1q'`
 +JAVA_VER_MAJOR=`java -version 2>&1 | sed 's/.*\?"\([0-9]*\)\..*".*/\1/; 1q'`
 +JAVA_VER_MINOR=`java -version 2>&1 | sed 's/.*\?"[0-9]*\.\([0-9]*\)\..*/\1/; 1q'`
 +
 +if [ -z "$JAVA_VER" ]
 +then
 +        echo "Java is not installed";
 +        exit 1;
 +fi
 +
 +##################################################
 +# JVM Options
 +##################################################
 +JAVA_OPTS="-DNODE_NAME=$NODE_NAME"
 +JAVA_OPTS="$JAVA_OPTS -server"
 +JAVA_OPTS="$JAVA_OPTS -Xms2048m"
 +JAVA_OPTS="$JAVA_OPTS -Xmx4096m"
 +
 +### Linux Large Page Setting
 +if [ $USE_LARGEPAGE == "true" ]; then
 + JAVA_OPTS="$JAVA_OPTS -XX:+UseLargePages";
 +fi
 +
 +### Garbage Collection Options
 +JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
 +JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$LOG_HOME/"
 +
 +if [ $JAVA_VER_MAJOR -ge 11 ]; then
 +        JAVA_OPTS="$JAVA_OPTS -Xlog:gc*,safepoint=info:file=$LOG_HOME/gc_%p_%t.log:tags,uptime,time,level:filecount=10,filesize=50m"
 +else
 +        JAVA_OPTS="$JAVA_OPTS -Xloggc:$LOG_HOME/gc_%p_%t.log"
 +        JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
 +        JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
 +        JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCApplicationStoppedTime"
 +        JAVA_OPTS="$JAVA_OPTS -XX:+UseGCLogFileRotation"
 +        JAVA_OPTS="$JAVA_OPTS -XX:NumberOfGCLogFiles=10"
 +        JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=50M"
 +fi
 +
 +### Collector type : G1 (low pause)
 +if [ $GC_TYPE == "g1" ]; then
 +        JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC"
 +        JAVA_OPTS="$JAVA_OPTS -XX:+ExplicitGCInvokesConcurrent"
 +        JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=500"
 +
 +### Collector type : Parallel (throughput)
 +elif [ $GC_TYPE == "parallel" ]; then
 +        JAVA_OPTS="$JAVA_OPTS -XX:+UseParallelGC"
 +        JAVA_OPTS="$JAVA_OPTS -XX:+UseParallelOldGC"
 +
 +### ShenandoahGC
 +elif [ $GC_TYPE == "shenandoah" ]; then
 +        JAVA_OPTS="$JAVA_OPTS -XX:+UseShenandoahGC"
 +        JAVA_OPTS="$JAVA_OPTS -XX:+AlwaysPreTouch"
 +        JAVA_OPTS="$JAVA_OPTS -XX:+UseNUMA"
 +
 +### ZGC (jdk 17+)
 +elif [ $GC_TYPE == "ZGC" ]; then
 + if [ $JAVA_VER_MAJOR -ge 17 ]; then
 +        JAVA_OPTS="$JAVA_OPTS -XX:+UseZGC"
 + else
 + echo "ERROR: JDK $JAVA_VER_MAJOR.$JAVA_VER_MINOR is not support ZGC!!!";
 + exit 1;
 + fi
 +else
 +        echo "ERROR: GC_TYPE is NOT SET!!!";
 +        exit 1;
 +fi
 +
 +JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
 +JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
 +JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.resolver.warning=true"
 +
 +### byteman
 +JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman"
 +
 +##################################################
 +# Bind Address
 +##################################################
 +JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=$BIND_ADDR"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.management=$MGNT_ADDR"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.private=$PRIVATE_ADDR"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.unsecure=$UNSECURE_ADDR"
 +
 +JAVA_OPTS="$JAVA_OPTS -Djboss.default.multicast.address=$MULTICAST_ADDR"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.messaging.cluster.password=$CLUSTER_PASSWD"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.messaging.group.address=$MESSAGE_ADDR"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.messaging.group.port=$MESSAGE_PORT"
 +
 +# Management
 +JAVA_OPTS="$JAVA_OPTS -Djboss.management.http.port=$MGNT_HTTP_PORT"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.management.https.port=$MGNT_HTTPS_PORT"
 +
 +# Port Offset
 +JAVA_OPTS="$JAVA_OPTS -Djboss.socket.binding.port-offset=$PORT_OFFSET"
 +
 +# Ports
 +JAVA_OPTS="$JAVA_OPTS -Djboss.ajp.port=$PORT_AJP"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.http.port=$PORT_HTTP"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.https.port=$PORT_HTTPS"
 +
 +# modcluster proxy list
 +#JAVA_OPTS="$JAVA_OPTS -Djboss.mod_cluster.proxyList=address1:port1,address2:port2"
 +#JAVA_OPTS="$JAVA_OPTS -Djboss.mod_cluster.excludedContexts=host1:context1,host2:context2,host3:context3"
 +#JAVA_OPTS="$JAVA_OPTS -Djboss.mod_cluster.jvmRoute="
 +
 +### JBoss Env Setting - Global
 +#JAVA_OPTS="$JAVA_OPTS -Djboss.qualified.host.name=$NODE_NAME"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.home.dir=$JBOSS_HOME"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.host.name=$NODE_NAME"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.host.default.config=$HOST_CONFIG_FILE"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.node.name=$NODE_NAME"
 +JAVA_OPTS="$JAVA_OPTS -DjvmRoute=$NODE_NAME"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.tx.node.id=$NODE_NAME"
 +JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.boot.log.file=$LOG_HOME/boot.log"
 +
 +### JBoss Env Setting - Standalone mode
 +JAVA_OPTS="$JAVA_OPTS -Djboss.server.base.dir=$SERVER_BASE_DIR"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=$SERVER_CONFIG_FILE"
 +JAVA_OPTS="$JAVA_OPTS -Djboss.server.log.dir=$LOG_HOME"
 +
 +JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$LD_LIBRARY_PATH"
 +
 +### Custom Settings
 +#JAVA_OPTS="$JAVA_OPTS -Dlogging.configuration=file:CONF_DIR/logging.properties"
 +
 +# anti log4shell
 +JAVA_OPTS="$JAVA_OPTS -Dlog4j2.formatMsgNoLookups=true"
 +
 +export JAVA_OPTS
 +
 +echo "================================================"
 +echo "JBOSS_HOME=$JBOSS_HOME"
 +echo "SERVER_HOME=$SERVER_HOME"
 +echo "NODE_NAME=$NODE_NAME"
 +echo "HOST_ADDR=$HOST_ADDR"
 +echo "SERVER_CONFIG_FILE=$SERVER_CONFIG_FILE"
 +echo "JAVA_VER=$JAVA_VER"
 +echo "JAVA_OPTS=$JAVA_OPTS"
 +echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 +echo "================================================"
 +
 +# EOF
 +</code>
 +</WRAP>
 +
 +==== JDK 1.4 ~ 11버전을 위한 환경파일 ====
 +
  
 <WRAP prewrap> <WRAP prewrap>
줄 167: 줄 374:
 else else
  echo "ERROR: GC_TYPE is NOT SET!!!";  echo "ERROR: GC_TYPE is NOT SET!!!";
- exit 0;+ exit 1;
 fi fi
  
줄 393: 줄 600:
 </code> </code>
 </WRAP> </WRAP>
 +
 +===== status.sh =====
 +<WRAP prewrap>
 +<code vim status.sh>
 +#!/bin/sh
 +##############################################
 +# instance    : template
 +# description : instance start script
 +# date        : 2014-10-07
 +# author      : kwlee2@linuxdata.co.kr
 +##############################################
 +ABSOLUTE_PATH="$(cd $(dirname "$0") && pwd -P)"
 +PROFILE_PATH="${ABSOLUTE_PATH%/*}"
 +DIR_NAME="${PROFILE_PATH##*/}" # bin dir
 +#DIR_NAME="${ABSOLUTE_PATH##*/}" # root dir
 +
 +. $ABSOLUTE_PATH/jboss.env
 +
 +PID=`ps -ef | grep java | grep "NODE_NAME=$NODE_NAME" | grep "jboss.server.base.dir=$SERVER_BASE_DIR" | awk '{print $2}'`
 +echo $PID
 +
 +if [ "$PID" == "" ]
 +then
 +    echo "JBoss SERVER - [$NODE_NAME] is NOT RUNNING..."
 +    exit 1;
 +else
 +    echo "JBoss SERVER - [$NODE_NAME] is RUNNING PID : ${PID}"
 +    exit 0;
 +fi
 +</code>
 +</WRAP>
 +
  
 ===== multicast_send.sh ===== ===== multicast_send.sh =====
  • jboss_eap_general_configuration_script.1641183487.txt.gz
  • 마지막으로 수정됨: 2022/01/03 04:18
  • 저자 koov