From 33261655136bedeca95e8254d0d70ac32fa8a5d1 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Fri, 10 Mar 2017 11:06:04 +0530 Subject: [PATCH] Fixing the JVM startup issue in the analytics profile. --- modules/distribution/pom.xml | 25 ++---- .../src/analytics/bin/load-spark-env-vars.sh | 2 +- .../src/analytics/bin/wso2server.sh | 82 ++++++++++++------- modules/distribution/src/assembly/bin.xml | 33 ++++++++ modules/distribution/src/assembly/dist.xml | 59 ------------- pom.xml | 2 +- 6 files changed, 94 insertions(+), 109 deletions(-) delete mode 100644 modules/distribution/src/assembly/dist.xml diff --git a/modules/distribution/pom.xml b/modules/distribution/pom.xml index e95119e2..5dfb1737 100644 --- a/modules/distribution/pom.xml +++ b/modules/distribution/pom.xml @@ -766,24 +766,6 @@ org.apache.maven.plugins maven-assembly-plugin - - 1-pre-dist - test - - - single - - - false - UTF-8 - - ${basedir}/src/assembly/filter.properties - - - ${basedir}/src/assembly/dist.xml - - - 2-dist package @@ -796,10 +778,15 @@ ${basedir}/src/assembly/filter.properties - \ ${basedir}/src/assembly/bin.xml + + 0775 + 0775 + 0644 + 0644 + diff --git a/modules/distribution/src/analytics/bin/load-spark-env-vars.sh b/modules/distribution/src/analytics/bin/load-spark-env-vars.sh index 51a8d2fd..15a40f4c 100755 --- a/modules/distribution/src/analytics/bin/load-spark-env-vars.sh +++ b/modules/distribution/src/analytics/bin/load-spark-env-vars.sh @@ -3,7 +3,7 @@ echo 'Loading spark environment variables ' export CARBON_SPARK_HOME=$CARBON_HOME -export _SPARK_ASSEMBLY=$CARBON_SPARK_HOME/components/plugins/spark-core_2.10_*.wso2*.jar +export _SPARK_ASSEMBLY=$CARBON_SPARK_HOME/../components/plugins/spark-core_2.10_*.wso2*.jar export SPARK_SCALA_VERSION=2.10 # *** jars will be added to the spark classpath in the code itself. check DAS-105 # export SPARK_CLASSPATH=`java -cp $CARBON_SPARK_HOME/repository/components/plugins/org.wso2.carbon.analytics.spark.utils*.jar org.wso2.carbon.analytics.spark.utils.ComputeClasspath $CARBON_HOME` diff --git a/modules/distribution/src/analytics/bin/wso2server.sh b/modules/distribution/src/analytics/bin/wso2server.sh index 888ab338..ee921c11 100755 --- a/modules/distribution/src/analytics/bin/wso2server.sh +++ b/modules/distribution/src/analytics/bin/wso2server.sh @@ -75,7 +75,7 @@ PRGDIR=`dirname "$PRG"` [ -z "$CARBON_HOME" ] && CARBON_HOME=`cd "$PRGDIR/.." ; pwd` # Set AXIS2_HOME. Needed for One Click JAR Download -AXIS2_HOME=$CARBON_HOME +AXIS2_HOME="$CARBON_HOME" # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin; then @@ -139,21 +139,24 @@ fi # ----- Process the input command ---------------------------------------------- args="" -NODE_PARAMS="" +NODE_PARAMS="-DdisableMl=false " for c in $* do if [ "$c" = "-receiverNode" ]; then - NODE_PARAMS="-DdisableAnalyticsEngine=true -DdisableAnalyticsExecution=true -DdisableIndexing=true -DdisableDataPurging=false -DdisableAnalyticsSparkCtx=true -DdisableAnalyticsStats=true" + NODE_PARAMS="-DdisableAnalyticsEngine=true -DdisableAnalyticsExecution=true -DdisableIndexing=true -DdisableDataPurging=false -DdisableAnalyticsSparkCtx=true -DdisableAnalyticsStats=true -DdisableMl=true " echo "Starting Data Analytics Server node as a Receiver Node" elif [ "$c" = "-indexerNode" ]; then - NODE_PARAMS="-DdisableAnalyticsExecution=true -DdisableAnalyticsEngine=true -DdisableEventSink=true -DdisableAnalyticsSparkCtx=true -DdisableAnalyticsStats=true -DdisableDataPurging=true" + NODE_PARAMS="-DdisableAnalyticsExecution=true -DdisableAnalyticsEngine=true -DdisableEventSink=true -DdisableAnalyticsSparkCtx=true -DdisableAnalyticsStats=true -DdisableDataPurging=true -DdisableMl=true " echo "Starting Data Analytics Server node as an Indexer Node" elif [ "$c" = "-analyzerNode" ]; then - NODE_PARAMS="-DdisableIndexing=true -DdisableEventSink=true -DdisableDataPurging=true -DenableAnalyticsStats=true" + NODE_PARAMS="-DdisableIndexing=true -DdisableEventSink=true -DdisableDataPurging=true -DenableAnalyticsStats=true -DdisableMl=true " echo "Starting Data Analytics Server node as an Analyzer Node" elif [ "$c" = "-dashboardNode" ]; then - NODE_PARAMS="-DdisableIndexing=true -DdisableEventSink=true -DdisableDataPurging=true -DenableAnalyticsStats=true -DdisableAnalyticsExecution=true -DdisableAnalyticsEngine=true -DdisableAnalyticsSparkCtx=true " + NODE_PARAMS="-DdisableIndexing=true -DdisableEventSink=true -DdisableDataPurging=true -DenableAnalyticsStats=true -DdisableAnalyticsExecution=true -DdisableAnalyticsEngine=true -DdisableAnalyticsSparkCtx=true -DdisableMl=true " echo "Starting Data Analytics Server node as an Analyzer Node" + elif [ "$c" = "-mlNode" ]; then + NODE_PARAMS="-DdisableAnalyticsExecution=true -DdisableEventSink=true -DdisableIndexing=true -DdisableDataPurging=true -DenableAnalyticsStats=true -DdisableMl=false " + echo "Starting Data Analytics Server node as a Machine Learner Node" elif [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ]; then CMD="--debug" continue @@ -194,19 +197,19 @@ elif [ "$CMD" = "start" ]; then exit 0 fi fi - export CARBON_HOME=$CARBON_HOME + export CARBON_HOME="$CARBON_HOME" # using nohup sh to avoid erros in solaris OS.TODO nohup sh $CARBON_HOME/bin/wso2server.sh $args $NODE_PARAMS > /dev/null 2>&1 & exit 0 elif [ "$CMD" = "stop" ]; then - export CARBON_HOME=$CARBON_HOME - kill -term `cat $CARBON_HOME/wso2carbon.pid` + export CARBON_HOME="$CARBON_HOME" + kill -term `cat "$CARBON_HOME"/wso2carbon.pid` exit 0 elif [ "$CMD" = "restart" ]; then - export CARBON_HOME=$CARBON_HOME - kill -term `cat $CARBON_HOME/wso2carbon.pid` + export CARBON_HOME="$CARBON_HOME" + kill -term `cat "$CARBON_HOME"/wso2carbon.pid` process_status=0 - pid=`cat $CARBON_HOME/wso2carbon.pid` + pid=`cat "$CARBON_HOME"/wso2carbon.pid` while [ "$process_status" -eq "0" ] do sleep 1; @@ -215,13 +218,13 @@ elif [ "$CMD" = "restart" ]; then done # using nohup sh to avoid erros in solaris OS.TODO - nohup sh $CARBON_HOME/bin/wso2server.sh $args $NODE_PARAMS > /dev/null 2>&1 & + nohup sh "$CARBON_HOME"/bin/wso2server.sh $args $NODE_PARAMS > /dev/null 2>&1 & exit 0 elif [ "$CMD" = "test" ]; then JAVACMD="exec "$JAVACMD"" elif [ "$CMD" = "version" ]; then - cat $CARBON_HOME/bin/version.txt - cat $CARBON_HOME/bin/wso2carbon-version.txt + cat "$CARBON_HOME"/bin/version.txt + cat "$CARBON_HOME"/bin/wso2carbon-version.txt exit 0 fi @@ -233,14 +236,14 @@ if [ "$jdk_17" = "" ]; then fi CARBON_XBOOTCLASSPATH="" -for f in "$CARBON_HOME"/lib/xboot/*.jar +for f in "$CARBON_HOME"/../lib/xboot/*.jar do - if [ "$f" != "$CARBON_HOME/lib/xboot/*.jar" ];then + if [ "$f" != "$CARBON_HOME/../lib/xboot/*.jar" ];then CARBON_XBOOTCLASSPATH="$CARBON_XBOOTCLASSPATH":$f fi done -JAVA_ENDORSED_DIRS="$CARBON_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" +JAVA_ENDORSED_DIRS="$CARBON_HOME/../lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" CARBON_CLASSPATH="" if [ -e "$JAVA_HOME/lib/tools.jar" ]; then @@ -252,7 +255,7 @@ do CARBON_CLASSPATH="$CARBON_CLASSPATH":$f fi done -for t in "$CARBON_HOME"/lib/commons-lang*.jar +for t in "$CARBON_HOME"/../lib/commons-lang*.jar do CARBON_CLASSPATH="$CARBON_CLASSPATH":$t done @@ -270,21 +273,45 @@ fi # ----- Execute The Requested Command ----------------------------------------- echo JAVA_HOME environment variable is set to $JAVA_HOME -echo CARBON_HOME environment variable is set to $CARBON_HOME +echo CARBON_HOME environment variable is set to "$CARBON_HOME" cd "$CARBON_HOME" -TMP_DIR=$CARBON_HOME/tmp +TMP_DIR="$CARBON_HOME"/tmp if [ -d "$TMP_DIR" ]; then -rm -rf "$TMP_DIR" +rm -rf "$TMP_DIR"/* fi START_EXIT_STATUS=121 status=$START_EXIT_STATUS +if [ -z "$JVM_MEM_OPTS" ]; then + java_version=$("$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}') + JVM_MEM_OPTS="-Xms256m -Xmx2048m" + if [ "$java_version" \< "1.8" ]; then + JVM_MEM_OPTS="$JVM_MEM_OPTS -XX:MaxPermSize=256m" + fi +fi +echo "Using Java memory options: $JVM_MEM_OPTS" + #load spark environment variables . $CARBON_HOME/bin/load-spark-env-vars.sh +#setting up profile parameter for runtime in EI +PROFILE_SELECTED="false" +for i in "$@"; do + if echo "$i" | grep -q "Dprofile"; then + PROFILE_SELECTED="true" + fi +done + +if [ "$PROFILE_SELECTED" = false ] ; then + NODE_PARAMS="$NODE_PARAMS -Dprofile=analytics-default" +fi + +#adding ei specific class path to wso2/components +CARBON_CLASSPATH="$CARBON_CLASSPATH":"$CARBON_HOME/../components/plugins/" + #To monitor a Carbon server in remote JMX mode on linux host machines, set the below system property. # -Djava.rmi.server.hostname="your.IP.goes.here" @@ -292,7 +319,7 @@ while [ "$status" = "$START_EXIT_STATUS" ] do $JAVACMD \ -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \ - -Xms256m -Xmx1024m -XX:MaxPermSize=256m \ + $JVM_MEM_OPTS \ -XX:+HeapDumpOnOutOfMemoryError \ -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \ $JAVA_OPTS \ @@ -330,12 +357,9 @@ do -Dfile.encoding=UTF8 \ -Djava.net.preferIPv4Stack=true \ -Dcom.ibm.cacheLocalHost=true \ - -Dmqtt.broker.host="localhost" \ - -Dmqtt.broker.port="1886" \ - -Diot.keymanager.host="localhost" \ - -Diot.keymanager.https.port="9443" \ - -Diot.gateway.host="localhost" \ - -Diot.gateway.https.port="8243" \ + -DworkerNode=false \ + -Dorg.apache.cxf.io.CachedOutputStream.Threshold=104857600 \ + -Dcarbon.das.c5.enabled="true" \ $NODE_PARAMS \ org.wso2.carbon.bootstrap.Bootstrap $* status=$? diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml index 3e899f8e..67bcee2c 100755 --- a/modules/distribution/src/assembly/bin.xml +++ b/modules/distribution/src/assembly/bin.xml @@ -595,6 +595,19 @@ **/wso2server.bat + + ../p2-profile/iot-core-profile/target/wso2carbon-core-${carbon.kernel.version}/wso2/components + + ${pom.artifactId}-${pom.version}/wso2/components + + **/eclipse.ini + **/*.lock + **/.data + **/.settings + features/** + **/org.wso2.carbon.feature.mgt.ui* + + @@ -627,6 +640,12 @@ ../p2-profile/analytics-profile/target/wso2carbon-core-${carbon.kernel.version}/wso2/conf ${pom.artifactId}-${pom.version}/wso2/analytics/conf + + **/carbon.xml + **/log4j.properties + **/jndi.properties + **/registry.xml + @@ -788,6 +807,20 @@ + + ../p2-profile/analytics-profile/target/wso2carbon-core-${carbon.kernel.version}/wso2/components + + ${pom.artifactId}-${pom.version}/wso2/components + + **/eclipse.ini + **/*.lock + **/.data + **/.settings + features/** + + + + diff --git a/modules/distribution/src/assembly/dist.xml b/modules/distribution/src/assembly/dist.xml deleted file mode 100644 index e27c8137..00000000 --- a/modules/distribution/src/assembly/dist.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - wso2-iot-dist - - zip - - - false - - - - ../p2-profile/iot-core-profile/target/wso2carbon-core-${carbon.kernel.version}/wso2/components - - ${pom.artifactId}-${pom.version}/wso2/components - - **/eclipse.ini - **/*.lock - **/.data - **/.settings - features/** - **/org.wso2.carbon.feature.mgt.ui* - - - - - ../p2-profile/analytics-profile/target/wso2carbon-core-${carbon.kernel.version}/wso2/components - - ${pom.artifactId}-${pom.version}/wso2/components - - **/eclipse.ini - **/*.lock - **/.data - **/.settings - features/** - **/org.wso2.carbon.feature.mgt.ui* - - - plugins/** - - - - - diff --git a/pom.xml b/pom.xml index 6d511b07..3c21476e 100644 --- a/pom.xml +++ b/pom.xml @@ -1786,7 +1786,7 @@ maven-assembly-plugin - 2.4 + 3.0.0 org.apache.maven.plugins