tomcat.env

이강우 2015/08/03 16:14

tomcat.env

##############################################
# instance    : sample
# description : sample instance environment
# date        : 2015-03-27
# author      : kwlee2@linuxdata.co.kr
# copyright   : Linux Data System co.
#               http://linuxdata.co.kr
##############################################

##############################################
# WARNING : MUST Set SERVER_NAME with same name of current directory
##############################################
SERVER_NAME="sample"
TOMCAT_USER="root"
#DATE=`date "+%F_%T"`
DATE=`date "+%Y%m%d-%H%M%S"`
UNAME=`id -u -n`
ENCODING="UTF-8"

##############################################
# Catalina Environment
##############################################
export CATALINA_HOME="/software/tomcat"
export CATALINA_BASE="$CATALINA_HOME/servers/$SERVER_NAME"
export CATALINA_LOGS="$CATALINA_BASE/logs"
export CATALINA_OPTS="-Denv=product -Denv.servername=$SERVER_NAME -Djava.security.egd=file:/dev/./urandom"
export CATALINA_OUT="$CATALINA_LOGS/catalina.out"
export CATALINA_PID="$CATALINA_BASE/catalina.pid"
export CATALINA_TMPDIR="$CATALINA_BASE/temp"

export LANG="en_US.$ENCODING"

# JMX
#export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote"
#export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.port=7191"
#export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
#export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"

##############################################
# Java JVM Environment
##############################################

# JAVA_OPTS
JAVA_OPTS="-DSERVER_NAME=$SERVER_NAME"
JAVA_OPTS="$JAVA_OPTS -server"
JAVA_OPTS="$JAVA_OPTS -Xms512M"
JAVA_OPTS="$JAVA_OPTS -Xmx1024M"
JAVA_OPTS="$JAVA_OPTS -verbose:gc"
JAVA_OPTS="$JAVA_OPTS -Xloggc:$CATALINA_LOGS/gc_$DATE.log"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGC"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC"
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$CATALINA_LOGS/heapdump_%p.hprof"
JAVA_OPTS="$JAVA_OPTS -XX:+DoEscapeAnalysis"
JAVA_OPTS="$JAVA_OPTS -XX:+UseCompressedOops"

# CMS GC - low pause
#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"
#JAVA_OPTS="$JAVA_OPTS -XX:MaxTenuringThreshold=32"

# Parallel GC - Throughput (recommend)
JAVA_OPTS="$JAVA_OPTS -XX:+UseParallelGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParallelOldGC"

# G1 GC
#JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC"

# AWT headless
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"

# Using only IPv4
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"

# Address / Port Definition
JAVA_OPTS="$JAVA_OPTS -Dtomcat.address.management=127.0.0.1"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.address.http=0.0.0.0"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.address.ajp=0.0.0.0"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.port.management=8005"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.port.http=8080"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.port.ajp=8009"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.port.https=8443"

# Catalina Connector Attribute
JAVA_OPTS="$JAVA_OPTS -Dtomcat.connector.URIEncoding=$ENCODING"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.connector.maxPostSize=2097152"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.connector.maxThreads=400"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.connector.server=Tomcat"

# file encoding
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=$ENCODING"
JAVA_OPTS="$JAVA_OPTS -Dfile.client.encoding=$ENCODING"
JAVA_OPTS="$JAVA_OPTS -Dclient.encoding.override=$ENCODING"


##############################################
# Session Clustering
#
# WARNING :
# In order to use the Session Clustering,
# then conf/server.xml.cluster file should be overwritten as conf/server.xml
# receiver.address MUST set to !!REAL!! Address (Not 0.0.0.0)
#
JAVA_OPTS="$JAVA_OPTS -Dtomcat.engine.jvmRoute=$SERVER_NAME"
#JAVA_OPTS="$JAVA_OPTS -Dtomcat.engine.sessionCookieName=JSESSIONID"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.cluster.member.address=228.0.0.1"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.cluster.member.port=45564"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.cluster.receiver.address=0.0.0.0"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.cluster.receiver.port=5001"

# Host Variables
JAVA_OPTS="$JAVA_OPTS -Dtomcat.engine.localhost.appBase=webapps"
JAVA_OPTS="$JAVA_OPTS -Dtomcat.engine.localhost.workDir=work"

# Using Tomcat Native
JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$CATALINA_HOME/lib"

##############################################
# Custom Variables Here

# anti log4shell
JAVA_OPTS="$JAVA_OPTS -Dlog4j2.formatMsgNoLookups=true"

export JAVA_OPTS

# EOF
@echo off
REM ##############################################
REM # instance    : sample
REM # description : sample instance environment
REM # date        : 2016-08-03
REM # author      : KangWoo Lee
REM #               kwlee2@linuxdata.co.kr
REM # copyright   : Linux Data System co.
REM #               http:\\linuxdata.co.kr
REM # platform    : WINDOWS / DOS
REM ##############################################

REM ##############################################
REM # WARNING : MUST set SERVER_NAME with same name of current directory
REM ##############################################

set SERVER_NAME=sample
set DATESTR=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
set ENCODING=UTF-8

REM ##############################################
REM # Catalina Environment
REM ##############################################
set CATALINA_HOME=E:\프로그램\Tomcat\apache-tomcat-8.5.4_win32_x86_64
set CATALINA_BASE=%CATALINA_HOME%\SERVERS\%SERVER_NAME%
set CATALINA_LOGS=%CATALINA_BASE%\logs
set CATALINA_OPTS=-Denv=product -Denv.servername=%SERVER_NAME%
set CATALINA_OUT=%CATALINA_LOGS%\catalina.out
set CATALINA_PID=%CATALINA_BASE%\catalina.pid
set CATALINA_TMPDIR=%CATALINA_BASE%\temp

set LANG=en_US.%ENCODING%

REM ##### JMX #####
REM set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote
REM set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.port=7191
REM set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.ssl=false
REM set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false

REM ##############################################
REM # Java JVM Environment
REM ##############################################

set JAVA_HOME=D:\Devel\Java\jdk1.8.0_73

REM ##### JAVA_OPTS #####
set JAVA_OPTS=-DSERVER_NAME=%SERVER_NAME%
set JAVA_OPTS=%JAVA_OPTS% -server
set JAVA_OPTS=%JAVA_OPTS% -Xms512M
set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set JAVA_OPTS=%JAVA_OPTS% -verbose:gc
set JAVA_OPTS=%JAVA_OPTS% -Xloggc:%CATALINA_LOGS%\gc_%DATESTR%.log
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGC
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintHeapAtGC
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
set JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=%CATALINA_LOGS%\heapdump_%p.hprof
set JAVA_OPTS=%JAVA_OPTS% -XX:+DoEscapeAnalysis
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseCompressedOops

REM ##### CMS GC - low pause #####
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+CMSClassUnloadingEnabled
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+ExplicitGCInvokesConcurrent
REM set JAVA_OPTS=%JAVA_OPTS% -XX:CMSInitiatingOccupancyFraction=80
REM set JAVA_OPTS=%JAVA_OPTS% -XX:CMSIncrementalSafetyFactor=20
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+UseCMSInitiatingOccupancyOnly
REM set JAVA_OPTS=%JAVA_OPTS% -XX:MaxTenuringThreshold=32

REM ##### Parallel GC - Throughput (recommend) #####
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParallelGC
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParallelOldGC

# G1 GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseG1GC

REM ##### AWT headless #####
set JAVA_OPTS=%JAVA_OPTS% -Djava.awt.headless=true

REM ##### Using only IPv4 #####
set JAVA_OPTS=%JAVA_OPTS% -Djava.net.preferIPv4Stack=true

REM ##### Address \ Port Definition #####
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.address.management=127.0.0.1
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.address.http=0.0.0.0
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.address.ajp=0.0.0.0
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.port.management=8005
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.port.http=8080
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.port.ajp=8009
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.port.https=8443

REM ##### Catalina Connector Attribute #####
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.connector.URIEncoding=%ENCODING%
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.connector.maxPostSize=2097152
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.connector.maxThreads=400
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.connector.server=Tomcat

REM ##### file encoding
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=%ENCODING%
set JAVA_OPTS=%JAVA_OPTS% -Dfile.client.encoding=%ENCODING%
set JAVA_OPTS=%JAVA_OPTS% -Dclient.encoding.override=%ENCODING%

REM ##############################################
REM # Session Clustering
REM #
REM # WARNING :
REM # In order to use the Session Clustering,
REM # then conf\server.xml.cluster file should be overwritten as conf\server.xml
REM # receiver.address MUST set to !!REAL!! Address (Not 0.0.0.0)
REM ##############################################
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.engine.jvmRoute=%SERVER_NAME%
REM set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.engine.sessionCookieName=JSESSIONID
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.cluster.member.address=228.0.0.1
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.cluster.member.port=45564
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.cluster.receiver.address=0.0.0.0
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.cluster.receiver.port=5001

REM ##### Host Variables
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.engine.localhost.appBase=webapps
set JAVA_OPTS=%JAVA_OPTS% -Dtomcat.engine.localhost.workDir=work

REM ##### Using Tomcat Native
set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path=%CATALINA_HOME%\lib

REM ##############################################
REM # Custom Variables Here

REM # anti log4shell
set JAVA_OPTS=%JAVA_OPTS% -Dlog4j2.formatMsgNoLookups=true

REM EOF
로그인하면 댓글을 남길 수 있습니다.
  • tomcat.env.txt
  • 마지막으로 수정됨: 2021/12/13 04:43
  • 저자 koov