JBoss EAP General configuration script

add-user.sh
#!/bin/sh
ABSOLUTE_PATH="$(cd $(dirname "$0") && pwd -P)"
DIR_NAME="${ABSOLUTE_PATH##*/}"
 
. $ABSOLUTE_PATH/jboss.env
 
#JAVA_OPTS="$JAVA_OPTS -Djboss.domain.config.user.dir=../domain/configuration"
JAVA_OPTS="$JAVA_OPTS -Djboss.server.config.user.dir=$SERVER_BASE_DIR/configuration "
 
#$JBOSS_HOME/bin/add-user.sh $@
$JBOSS_HOME/bin/add-user.sh
jboss.env
##################################################
# description : JBoss EAP 7.x Standalone
# date        : 2017-05-11
# author      : kwlee2@linuxdata.co.kr
##################################################
DATE=`date "+%Y%m%d_%H%M%S"`
UNAME=`id -u -n`
 
JBOSS_USER="root"
NODE_NAME="node11"
 
##################################################
# JBOSS Common Setup
##################################################
JBOSS_HOME="/software/jboss7"
 
SERVER_HOME="$JBOSS_HOME/SERVERS"
SERVER_BASE_DIR="$SERVER_HOME/$NODE_NAME"
 
LOG_HOME="$SERVER_BASE_DIR/logs"
 
BIND_ADDR="192.168.0.73"
MGNT_ADDR="192.168.0.73"
PRIVATE_ADDR="192.168.0.73"
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"		# "cms", "parallel", "g1"(only jdk 7u4 or greater)
USE_LARGEPAGE="false"	# "true", "false"
 
##################################################
# Configration File
##################################################
SERVER_CONFIG_FILE="standalone-full-ha.xml"
 
##################################################
# Java Version Check
JAVA_VER=$(java -version 2>&1 | grep -i version | sed 's/.*version ".*\.\(.*\)\..*"/\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 -XX:+DoEscapeAnalysis"
JAVA_OPTS="$JAVA_OPTS -Xms2048m"
JAVA_OPTS="$JAVA_OPTS -Xmx4096m"
 
### Garbage Collection Options
JAVA_OPTS="$JAVA_OPTS -verbose:gc"
JAVA_OPTS="$JAVA_OPTS -Xloggc:$LOG_HOME/gc_$DATE.log"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCApplicationStoppedTime"
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$LOG_HOME/"
 
# Use on x86_64
JAVA_OPTS="$JAVA_OPTS -XX:+UseCompressedOops"
 
### Collector type : CMS(low pause)
if [ $GC_TYPE == "cms" ]; then
	JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"			         
	JAVA_OPTS="$JAVA_OPTS -XX:+CMSClassUnloadingEnabled"		         
	JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"				         
	JAVA_OPTS="$JAVA_OPTS -XX:+ExplicitGCInvokesConcurrent"		         
	JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=80"	         
	JAVA_OPTS="$JAVA_OPTS -XX:CMSIncrementalSafetyFactor=20"	         
	JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly"	         
 
### Collector type : Parallel (throughput)
elif [ $GC_TYPE == "parallel" ]; then
	JAVA_OPTS="$JAVA_OPTS -XX:+UseParallelGC"
	JAVA_OPTS="$JAVA_OPTS -XX:+UseParallelOldGC"
 
### Collector type : G1 (low pause) ONLY USE for JDK 7u4 or greater
elif [ $GC_TYPE == "g1" ]; then
	JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC"
	JAVA_OPTS="$JAVA_OPTS -XX:+ExplicitGCInvokesConcurrent"
	JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=500"
 
else
	echo "ERROR: GC_TYPE is NOT SET!!!";
	exit 0;
fi
 
###########################
# Java Version setting
if [ $JAVA_VER -ge 8 ]; then
	JAVA_OPTS="$JAVA_OPTS -XX:+UseCompressedClassPointers"
	JAVA_OPTS="$JAVA_OPTS -XX:CompressedClassSpaceSize=1024M"
	JAVA_OPTS="$JAVA_OPTS -XX:MetaspaceSize=512M"
	JAVA_OPTS="$JAVA_OPTS -XX:MaxMetaspaceSize=512M"
elif [ $JAVA_VER -le 7 ]; then
	JAVA_OPTS="$JAVA_OPTS -XX:PermSize=256M"
	JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=256M"
fi
 
### Linux Large Page Setting
if [ $USE_LARGEPAGE == "true" ]; then
	JAVA_OPTS="$JAVA_OPTS -XX:+UseLargePages";
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"
 
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_OPTS=$JAVA_OPTS"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo "================================================"
 
# EOF

JBoss EAP 7 이후 버전에서는
org.apache.catalina.connector.URI_ENCODING=UTF-8
org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING=true
두가지 프로퍼티가 사용되지 않으므로 사실상 무시된다.

jboss.properties
org.apache.catalina.connector.URI_ENCODING=UTF-8
org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING=true
org.hornetq.core.message.impl.HDR_DUPLICATE_DETECTION_ID=$NODE_NAME
jboss-cli.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)"
DIR_NAME="${ABSOLUTE_PATH##*/}"
 
. $ABSOLUTE_PATH/jboss.env
 
#export JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=false "
 
if [ "$MGNT_ADDR" == "0.0.0.0" ]
then
	MGNT_ADDR=127.0.0.1
fi
 
echo "$JBOSS_HOME/bin/jboss-cli.sh  --controller=$MGNT_ADDR:$((MGNT_HTTP_PORT + PORT_OFFSET)) --connect $@"
$JBOSS_HOME/bin/jboss-cli.sh  --controller=$MGNT_ADDR:$((MGNT_HTTP_PORT + PORT_OFFSET)) --connect $@
kill.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)"
DIR_NAME="${ABSOLUTE_PATH##*/}"
 
. $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;
fi
 
#ps -ef | grep java | grep "NODE_NAME=$NODE_NAME" | grep "jboss.server.base.dir=$SERVER_BASE_DIR" | awk {'print "kill -9 " $2'} | sh -x
kill -9 $PID
 
echo "Killing down SERVER $NODE_NAME..."
sleep 10
shutdown.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)"
DIR_NAME="${ABSOLUTE_PATH##*/}"
 
. $ABSOLUTE_PATH/jboss.env
 
PID=`ps -ef | grep java | grep "NODE_NAME=$NODE_NAME " | awk '{print $2}'`
echo $PID
 
if [ "$PID" == "" ]
then
    echo "JBoss SERVER - [$NODE_NAME] is NOT RUNNING..."
    exit 1;
fi
 
echo -n "Account:"
read USERNAME
echo -n "Password:"
read -s PASSWORD
echo ""
 
if [ "$PORT_OFFSET" != "" ]
then
	MGNT_HTTP_PORT=$(( $MGNT_HTTP_PORT + $PORT_OFFSET ))
fi
 
if [ "$MGNT_ADDR" == "0.0.0.0" ]
then
	MGNT_ADDR="127.0.0.1"
fi
 
echo "$JBOSS_HOME/bin/jboss-cli.sh --connect --controller=$MGNT_ADDR:$MGNT_HTTP_PORT --user=$USERNAME --password=$PASSWORD --command=shutdown"
$JBOSS_HOME/bin/jboss-cli.sh --connect --controller=$MGNT_ADDR:$MGNT_HTTP_PORT --user=$USERNAME --password=$PASSWORD --command=shutdown
 
if [ $? != 0 ]
then
        exit 1
fi
 
echo "Server $NODE_NAME Shutting Down..."
while true
do
PID=`ps -ef | grep java | grep "NODE_NAME=$NODE_NAME " | awk '{print $2}'`
echo "PID:$PID"
 
        if [ "$PID" == "" ]
        then
                break
        fi
        sleep 2
done
echo "Done."
start.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)"
DIR_NAME="${ABSOLUTE_PATH##*/}"
 
. $ABSOLUTE_PATH/jboss.env
 
PID=`ps -ef | grep java | grep "NODE_NAME=$NODE_NAME " | awk '{print $2}'`
echo $PID
 
if [ "$PID" != "" ]
then
    echo "JBoss SERVER - [$NODE_NAME] is already RUNNING..."
    exit 1;
fi
 
if [ -z "$NODE_NAME" ]
then
	echo -e "\e[33mWARNING\e[0m : \e[32mjboss.env is not configured.\e[0m"
	echo -e "\e[33mWARNING\e[0m : Program Exit."
	exit 1
fi
 
if [ "$DIR_NAME" != "$NODE_NAME" ]
then
	echo -e "\e[33mWARNING\e[0m : \e[32mDIRECTORY and NODE_NAME are not same\e[0m"
	echo -e "\e[33mWARNING\e[0m : Program Exit."
	exit 2
fi
 
if [ "$JBOSS_USER" != "$UNAME" ]
then
	echo -e "\e[33mWARNING\e[0m : Current User is [\e[31m$UNAME\e[0m]. MUST run to [\e[32m$JBOSS_USER\e[0m]."
	echo -e "\e[33mWARNING\e[0m : Program Exit."
	exit 3
fi
 
if [ ! -e "$JBOSS_HOME" -o ! -e "$SERVER_HOME" ]; then
	echo "JBOSS_HOME or SERVER_HOME is not Exists";
	exit 4
fi
 
if [ ! -d "$LOG_HOME" ]; then
	mkdir -p $LOG_HOME
fi
 
nohup $JBOSS_HOME/bin/standalone.sh -P=$SERVER_BASE_DIR/jboss.properties >> $LOG_HOME/jboss_console.log 2>&1 &
 
exit 0
# EOF
sysctl.conf
# Allow a 25MB UDP receive buffer for JGroups
net.core.rmem_max = 26214400
# Allow a 1MB UDP send buffer for JGroups
net.core.wmem_max = 1048576
 
# 기본값도 같이 변경해준다.
net.core.rmem_default = 26214400
net.core.wmem_default = 1048576
로그인하면 댓글을 남길 수 있습니다.
  • jboss_eap_general_configuration_script.txt
  • 마지막으로 수정됨: 2017/10/27 11:02
  • 저자 koov