ambari-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMBARI-22760) Infra Manager: install packages
Date Thu, 11 Jan 2018 12:36:00 GMT

    [ https://issues.apache.org/jira/browse/AMBARI-22760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16322147#comment-16322147
] 

ASF GitHub Bot commented on AMBARI-22760:
-----------------------------------------

oleewere closed pull request #85: AMBARI-22760 Infra Manager: install packages
URL: https://github.com/apache/ambari/pull/85
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ambari-infra/ambari-infra-assembly/pom.xml b/ambari-infra/ambari-infra-assembly/pom.xml
index bf0e6791d49..41fa5739c92 100644
--- a/ambari-infra/ambari-infra-assembly/pom.xml
+++ b/ambari-infra/ambari-infra-assembly/pom.xml
@@ -25,7 +25,7 @@
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>ambari-infra-assembly</artifactId>
-  <name>Ambari Infra Solr Assembly</name>
+  <name>Ambari Infra Assembly</name>
   <url>http://maven.apache.org</url>
 
   <properties>
@@ -41,7 +41,7 @@
     <infra-manager.package.name>ambari-infra-manager</infra-manager.package.name>
     <infra-manager.dir>${project.basedir}/../ambari-infra-manager</infra-manager.dir>
     <infra-manager.mapping.path>${mapping.base.path}/${infra-manager.package.name}</infra-manager.mapping.path>
-    <infra-manager.conf.mapping.path>/etc/${infra-manager.package.name}/conf</infra-manager.conf.mapping.path>
+    <infra-manager.conf.mapping.path>${infra-manager.mapping.path}/conf</infra-manager.conf.mapping.path>
   </properties>
 
   <profiles>
@@ -142,30 +142,16 @@
                     <scriptFile>${project.basedir}/src/main/package/rpm/manager/postinstall.sh</scriptFile>
                     <fileEncoding>utf-8</fileEncoding>
                   </postinstallScriptlet>
+                  <postremoveScriptlet>
+                    <scriptFile>${project.basedir}/src/main/package/rpm/manager/postremove.sh</scriptFile>
+                    <fileEncoding>utf-8</fileEncoding>
+                  </postremoveScriptlet>
                   <mappings>
                     <mapping>
                       <directory>${infra-manager.mapping.path}</directory>
                       <sources>
                         <source>
                           <location>${infra-manager.dir}/target/package</location>
-                          <excludes>
-                            <exclude>log4j.xml</exclude>
-                            <exclude>infra-manager.properties</exclude>
-                            <exclude>infra-manager-env.sh</exclude>
-                          </excludes>
-                        </source>
-                      </sources>
-                    </mapping>
-                    <mapping>
-                      <directory>${infra-manager.conf.mapping.path}</directory>
-                      <sources>
-                        <source>
-                          <location>${infra-manager.dir}/target/package</location>
-                          <includes>
-                            <include>log4j.xml</include>
-                            <include>infra-manager.properties</include>
-                            <include>infra-manager-env.sh</include>
-                          </includes>
                         </source>
                       </sources>
                     </mapping>
@@ -354,23 +340,6 @@
                         <group>root</group>
                         <prefix>${infra-manager.mapping.path}</prefix>
                       </mapper>
-                      <excludes>
-                        log4j.xml,infra-manager.properties,infra-manager-env.sh
-                      </excludes>
-                    </data>
-                    <data>
-                      <src>${infra-manager.dir}/target/package</src>
-                      <type>directory</type>
-                      <mapper>
-                        <prefix>${infra-manager.conf.mapping.path}</prefix>
-                        <type>perm</type>
-                        <user>root</user>
-                        <group>root</group>
-                        <filemode>644</filemode>
-                      </mapper>
-                      <includes>
-                        log4j.xml,infra-manager.properties,infra-manager-env.sh
-                      </includes>
                     </data>
                   </dataSet>
                 </configuration>
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst
index c8d6ecd2042..acce62dd2cb 100644
--- a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst
@@ -15,6 +15,13 @@
 # limitations under the License
 
 INFRA_MANAGER_LINK_NAME="/usr/bin/infra-manager"
-INFRA_MANAGER_SOURCE="/usr/lib/ambari-infra-manager/infraManager.sh"
+INFRA_MANAGER_SOURCE="/usr/lib/ambari-infra-manager/bin/infraManager.sh"
+INFRA_MANAGER_CONF_LINK_DIR="/etc/ambari-infra-manager"
+INFRA_MANAGER_CONF_LINK_NAME="$INFRA_MANAGER_CONF_LINK_DIR/conf"
+INFRA_MANAGER_CONF_SOURCE="/usr/lib/ambari-infra-manager/conf"
 
 rm -f $INFRA_MANAGER_LINK_NAME ; ln -s $INFRA_MANAGER_SOURCE $INFRA_MANAGER_LINK_NAME
+rm -f $INFRA_MANAGER_CONF_LINK_NAME
+rm -rf $INFRA_MANAGER_CONF_LINK_DIR
+mkdir -p $INFRA_MANAGER_CONF_LINK_DIR
+ln -s $INFRA_MANAGER_CONF_SOURCE $INFRA_MANAGER_CONF_LINK_NAME
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm
index 21a01faa534..e62abc6f2bc 100644
--- a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm
@@ -13,3 +13,11 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License
+
+INFRA_MANAGER_CONF_LINK_DIR="/etc/ambari-infra-manager"
+INFRA_MANAGER_CONF_LINK_NAME="$INFRA_MANAGER_CONF_LINK_DIR/conf"
+INFRA_MANAGER_LINK_NAME="/usr/bin/infra-manager"
+
+rm -f $INFRA_MANAGER_LINK_NAME
+rm -f $INFRA_MANAGER_CONF_LINK_NAME
+rm -rf $INFRA_MANAGER_CONF_LINK_DIR
\ No newline at end of file
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/rpm/manager/postinstall.sh
b/ambari-infra/ambari-infra-assembly/src/main/package/rpm/manager/postinstall.sh
index 48a39985c55..acce62dd2cb 100644
--- a/ambari-infra/ambari-infra-assembly/src/main/package/rpm/manager/postinstall.sh
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/rpm/manager/postinstall.sh
@@ -15,6 +15,13 @@
 # limitations under the License
 
 INFRA_MANAGER_LINK_NAME="/usr/bin/infra-manager"
-INFRA_MANAGER_SOURCE="/usr/lib/ambari-infra-manager/infraManager.sh"
+INFRA_MANAGER_SOURCE="/usr/lib/ambari-infra-manager/bin/infraManager.sh"
+INFRA_MANAGER_CONF_LINK_DIR="/etc/ambari-infra-manager"
+INFRA_MANAGER_CONF_LINK_NAME="$INFRA_MANAGER_CONF_LINK_DIR/conf"
+INFRA_MANAGER_CONF_SOURCE="/usr/lib/ambari-infra-manager/conf"
 
-rm -f $INFRA_MANAGER_LINK_NAME ; ln -s $INFRA_MANAGER_SOURCE $INFRA_MANAGER_LINK_NAME
\ No newline at end of file
+rm -f $INFRA_MANAGER_LINK_NAME ; ln -s $INFRA_MANAGER_SOURCE $INFRA_MANAGER_LINK_NAME
+rm -f $INFRA_MANAGER_CONF_LINK_NAME
+rm -rf $INFRA_MANAGER_CONF_LINK_DIR
+mkdir -p $INFRA_MANAGER_CONF_LINK_DIR
+ln -s $INFRA_MANAGER_CONF_SOURCE $INFRA_MANAGER_CONF_LINK_NAME
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/rpm/manager/postremove.sh
b/ambari-infra/ambari-infra-assembly/src/main/package/rpm/manager/postremove.sh
new file mode 100644
index 00000000000..e62abc6f2bc
--- /dev/null
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/rpm/manager/postremove.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+INFRA_MANAGER_CONF_LINK_DIR="/etc/ambari-infra-manager"
+INFRA_MANAGER_CONF_LINK_NAME="$INFRA_MANAGER_CONF_LINK_DIR/conf"
+INFRA_MANAGER_LINK_NAME="/usr/bin/infra-manager"
+
+rm -f $INFRA_MANAGER_LINK_NAME
+rm -f $INFRA_MANAGER_CONF_LINK_NAME
+rm -rf $INFRA_MANAGER_CONF_LINK_DIR
\ No newline at end of file
diff --git a/ambari-infra/ambari-infra-manager/build.xml b/ambari-infra/ambari-infra-manager/build.xml
index 3d0f4da8a05..6df3767c821 100644
--- a/ambari-infra/ambari-infra-manager/build.xml
+++ b/ambari-infra/ambari-infra-manager/build.xml
@@ -33,13 +33,16 @@
     <copy todir="target/package/libs" includeEmptyDirs="no">
       <fileset file="target/*.jar"/>
     </copy>
-    <copy todir="target/package" includeEmptyDirs="no">
-      <fileset file="src/main/resources/infraManager.sh"/>
+    <copy todir="target/package/conf" includeEmptyDirs="no">
       <fileset file="src/main/resources/infra-manager-env.sh"/>
       <fileset file="target/classes/infra-manager.properties"/>
-      <fileset file="target/classes/log4j.xml"/>
+      <fileset file="target/classes/log4j2.xml"/>
+    </copy>
+    <copy todir="target/package/bin" includeEmptyDirs="no">
+      <fileset file="src/main/resources/infraManager.sh"/>
     </copy>
-    <chmod file="target/package/*.sh" perm="755"/>
+    <chmod file="target/package/conf/infra-manager-env.sh" perm="755"/>
+    <chmod file="target/package/bin/infraManager.sh" perm="755"/>
     <tar compression="gzip" destfile="target/ambari-infra-manager.tar.gz">
       <tarfileset mode="755" dir="target/package">
         <include name="*.sh"/>
diff --git a/ambari-infra/ambari-infra-manager/pom.xml b/ambari-infra/ambari-infra-manager/pom.xml
index 75adb8dc43d..467dbad19a4 100644
--- a/ambari-infra/ambari-infra-manager/pom.xml
+++ b/ambari-infra/ambari-infra-manager/pom.xml
@@ -74,16 +74,6 @@
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
         <version>${spring-boot.version}</version>
-        <configuration>
-          <classifier>exec</classifier>
-        </configuration>
-        <executions>
-          <execution>
-            <goals>
-              <goal>repackage</goal>
-            </goals>
-          </execution>
-        </executions>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
index 179b2d1cd4c..a212164e7ea 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
@@ -41,7 +41,7 @@
 public class InfraManager {
 
   public static void main(String[] args) {
-    String pidFile = System.getenv("PID_FILE") == null ? "infra-manager.pid" : System.getenv("PID_FILE");
+    String pidFile = System.getenv("INFRA_MANAGER_PID_FILE") == null ? "infra-manager.pid"
: System.getenv("INFRA_MANAGER_PID_FILE");
     new SpringApplicationBuilder(InfraManager.class)
       .bannerMode(Banner.Mode.OFF)
       .listeners(new ApplicationPidFileWriter(pidFile))
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager-env.sh b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager-env.sh
index c7e11c3265a..6897ea47199 100644
--- a/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager-env.sh
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager-env.sh
@@ -15,4 +15,26 @@
 # limitations under the License.
 
 # Extend with java options or system properties. e.g.: INFRA_MANAGER_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=5007,server=y,suspend=n"
-export INFRA_MANAGER_OPTS=""
\ No newline at end of file
+export INFRA_MANAGER_OPTS=""
+
+# Log Search debug options
+# export INFRA_MANAGER_DEBUG=true
+# exoprt INFRA_MANAGER_DEBUG_SUSPEND=n
+export INFRA_MANAGER_DEBUG_PORT=5005
+
+# Log Search memory
+# export INFRA_MANAGER_JAVA_MEM="--Xmx1024m"
+
+# export LOG_PATH=/var/log/ambari-logsearch-logfeeder/
+# export LOG_FILE=logsearch.log
+
+# Pid file of the application
+# export INFRA_MANAGER_PID_DIR=/var/run/ambari-infra-manager
+# export INFRA_MANAGER_PID_FILE=infra-manager.pid
+
+# SSL settings"
+# export INFRA_MANAGER_SSL="true"
+# export INFRA_MANAGER_KEYSTORE_LOCATION="/my/path/keystore.jks"
+# export INFRA_MANAGER_KEYSTORE_TYPE="jks"
+# export INFRA_MANAGER_TRUSTSTORE_LOCATION="/my/path/trutstore.jks"
+# export INFRA_MANAGER_TRUSTSTORE_TYPE="jks"
\ No newline at end of file
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
index 61c08e5631d..70c46d33985 100644
--- a/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
@@ -41,7 +41,7 @@ infra-manager.jobs.solr_data_export.archive_audit_logs.solr.sort_column[1]=id
 infra-manager.jobs.solr_data_export.archive_audit_logs.solr.delete_query_text=logtime:[${start.logtime}
TO ${end.logtime}} OR (logtime:${end.logtime} AND id:[* TO ${end.id}])
 infra-manager.jobs.solr_data_export.archive_audit_logs.read_block_size=100
 infra-manager.jobs.solr_data_export.archive_audit_logs.write_block_size=150
-infra-manager.jobs.solr_data_export.archive_audit_logs.destination=S3
+infra-manager.jobs.solr_data_export.archive_audit_logs.destination=HDFS
 # TODO: logtime may not be enough: The same filename can be generated when more than write_block_size
count docs has the same logtime value
 infra-manager.jobs.solr_data_export.archive_audit_logs.file_name_suffix_column=logtime
 infra-manager.jobs.solr_data_export.archive_audit_logs.file_name_suffix_date_format=yyyy-MM-dd'T'HH-mm-ss.SSSX
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh b/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh
index bbf03dff4fe..0e3e749a48c 100644
--- a/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh
@@ -14,15 +14,259 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-: ${JAVA_HOME:?"Please set the JAVA_HOME variable!"}
-
 JVM="java"
-sdir="`dirname \"$0\"`"
-ldir="`dirname "$(readlink -f "$0")"`"
 
-DIR="$sdir"
-if [ "$sdir" != "$ldir" ]; then
-  DIR="$ldir"
+if [ -x $JAVA_HOME/bin/java ]; then
+  JVM=$JAVA_HOME/bin/java
+fi
+
+if [ "$INFRA_MANAGER_JAVA_MEM" = "" ]; then
+    INFRA_MANAGER_JAVA_MEM="-Xmx1g"
+fi
+
+readlinkf(){
+  # get real path on mac OSX
+  perl -MCwd -e 'print Cwd::abs_path shift' "$1";
+}
+
+if [ "$(uname -s)" = 'Linux' ]; then
+  SCRIPT_DIR="`dirname "$(readlink -f "$0")"`"
+else
+  SCRIPT_DIR="`dirname "$(readlinkf "$0")"`"
+fi
+
+INFRA_MANAGER_ROOT_DIR="`dirname \"$SCRIPT_DIR\"`"
+INFRA_MANAGER_LIBS_DIR="$INFRA_MANAGER_ROOT_DIR/libs"
+
+if [ "$INFRA_MANAGER_CONF_DIR" = "" ]; then
+  if [ -d "$INFRA_MANAGER_ROOT_DIR/conf" ]; then
+    INFRA_MANAGER_CONF_DIR="$INFRA_MANAGER_ROOT_DIR/conf"
+  fi
+fi
+
+if [ -f "$INFRA_MANAGER_CONF_DIR/infra-manager-env.sh" ]; then
+  source $INFRA_MANAGER_CONF_DIR/infra-manager-env.sh
+fi
+
+if [ ! -z "$INFRA_MANAGER_SOLR_CLIENT_SSL_INCLUDE" ]; then
+  source $INFRA_MANAGER_SOLR_CLIENT_SSL_INCLUDE
+fi
+
+if [ -z "$INFRA_MANAGER_PID_FILE" ]; then
+  INFRA_MANAGER_PID_DIR=$HOME
+  export INFRA_MANAGER_PID_FILE=$INFRA_MANAGER_PID_DIR/infra-manager.pid
+fi
+
+if [ -z "$LOG_FILE" ]; then
+  export LOG_FILE="infra-manager.log"
+fi
+
+INFRA_MANAGER_GC_LOGFILE="infra-manager-gc.log"
+
+if [ -z "$LOG_PATH" ]; then
+  LOG_FILE="$HOME/$LOG_FILE"
+  INFRA_MANAGER_GC_LOGFILE="$HOME/$INFRA_MANAGER_GC_LOGFILE"
+else
+  LOG_PATH_WITHOUT_SLASH=${LOG_PATH%/}
+  LOG_FILE="$LOG_PATH_WITHOUT_SLASH/$LOG_FILE"
+  INFRA_MANAGER_GC_LOGFILE="$LOG_PATH_WITHOUT_SLASH/$INFRA_MANAGER_GC_LOGFILE"
+fi
+
+INFRA_MANAGER_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$INFRA_MANAGER_GC_LOGFILE"
+
+function print_usage() {
+  cat << EOF
+
+   Usage: [<command>] [<arguments with flags>]
+
+   commands:
+     start                         Start Infra Manager
+     stop                          Stop Infra Manager
+     status                        Check Infra Manager is running or not (pid file)
+     help                          Print usage
+
+
+   start command arguments:
+     -d, --debug                   Start java process in debug mode
+     -f, --foreground              Start java process in foreground
+
+EOF
+}
+
+function spinner() {
+  local pid=$1
+  local delay=0.5
+  local spinstr='|/-\'
+  while [ "$(ps aux | awk '{print $2}' | grep -w $pid)" ]; do
+      local temp=${spinstr#?}
+      printf " [%c]  " "$spinstr"
+      local spinstr=$temp${spinstr%"$temp"}
+      sleep $delay
+      printf "\b\b\b\b\b\b"
+  done
+  printf "    \b\b\b\b"
+}
+
+function status() {
+  echo "Checking Infra Manager status ..." >&2
+  if [ -f "$INFRA_MANAGER_PID_FILE" ]; then
+    INFRA_MANAGER_PID=`cat "$INFRA_MANAGER_PID_FILE"`
+  else
+    echo "Infra Manager pid not exists. (probably the process is not running)" >&2
+    return 1
+  fi
+
+  if ps -p $INFRA_MANAGER_PID > /dev/null
+   then
+   echo "Infra Manager process is running. (pid: $INFRA_MANAGER_PID)" >&2
+   return 0
+  else
+   echo "Infra Manager process is not running." >&2
+   return 1
+  fi
+}
+
+function start() {
+  exit_status=$(status; echo $?)
+  if [ "$exit_status" = "0" ]; then
+    echo "Skipping start process."
+    exit 0
+  fi
+
+  FG="false"
+  INFRA_MANAGER_DEBUG_SUSPEND=${INFRA_MANAGER_DEBUG_SUSPEND:-n}
+  INFRA_MANAGER_DEBUG_PORT=${INFRA_MANAGER_DEBUG_PORT:-"5005"}
+
+  if [ "$INFRA_MANAGER_DEBUG" = "true" ]; then
+    INFRA_MANAGER_JAVA_OPTS="$INFRA_MANAGER_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$INFRA_MANAGER_DEBUG_PORT,server=y,suspend=$INFRA_MANAGER_DEBUG_SUSPEND
"
+  fi
+
+  if [ "$INFRA_MANAGER_SSL" = "true" ]; then
+    INFRA_MANAGER_JAVA_OPTS="$INFRA_MANAGER_JAVA_OPTS -Djavax.net.ssl.keyStore=$INFRA_MANAGER_KEYSTORE_LOCATION
-Djavax.net.ssl.keyStoreType=$INFRA_MANAGER_KEYSTORE_TYPE -Djavax.net.ssl.trustStore=$INFRA_MANAGER_TRUSTSTORE_LOCATION
-Djavax.net.ssl.trustStoreType=$INFRA_MANAGER_TRUSTSTORE_TYPE"
+  fi
+
+  if [ "$INFRA_MANAGER_JMX" = "true" ]; then
+   INFRA_MANAGER_JAVA_OPTS="$INFRA_MANAGER_JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=2099"
+  fi
+
+  if [ $# -gt 0 ]; then
+    while true; do
+      case "$1" in
+          -f|--foreground)
+              FG="true"
+              shift
+          ;;
+          -d|--debug)
+              if [ "$INFRA_MANAGER_DEBUG" != "true" ]; then
+                INFRA_MANAGER_JAVA_OPTS="$INFRA_MANAGER_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$INFRA_MANAGER_DEBUG_PORT,server=y,suspend=$INFRA_MANAGER_DEBUG_SUSPEND
"
+              fi
+              shift
+          ;;
+          *)
+              if [ "${1:0:2}" == "-D" ]; then
+                # pass thru any opts that begin with -D (java system props)
+                INFRA_MANAGER_JAVA_OPTS+=("$1")
+                echo "$INFRA_MANAGER_JAVA_OPTS"
+                shift
+              else
+                if [ "$1" != "" ]; then
+                  print_usage
+                  exit 1
+                else
+                  break
+                fi
+              fi
+          ;;
+      esac
+    done
+  fi
+
+  if [ $FG == "true" ]; then
+    echo "Starting Infra Manager... (foreground) pid_file=$INFRA_MANAGER_PID_FILE"
+    echo "Run command $JVM -cp '$INFRA_MANAGER_CONF_DIR:$INFRA_MANAGER_LIBS_DIR/*' $INFRA_MANAGER_GC_OPTS
$INFRA_MANAGER_JAVA_OPTS $INFRA_MANAGER_JAVA_MEM org.apache.ambari.infra.InfraManager"
+    $JVM -cp "$INFRA_MANAGER_CONF_DIR:$INFRA_MANAGER_LIBS_DIR/*" $INFRA_MANAGER_GC_OPTS $INFRA_MANAGER_JAVA_OPTS
$INFRA_MANAGER_JAVA_MEM org.apache.ambari.infra.InfraManager
+  else
+   echo "Starting Infra Manager... Output file=$LOG_FILE pid_file=$INFRA_MANAGER_PID_FILE"
+   echo "Run command nohup $JVM -cp '$INFRA_MANAGER_CONF_DIR:$INFRA_MANAGER_LIBS_DIR/*' $INFRA_MANAGER_GC_OPTS
$INFRA_MANAGER_JAVA_OPTS $INFRA_MANAGER_JAVA_MEM org.apache.ambari.infra.InfraManager"
+   nohup $JVM -cp "$INFRA_MANAGER_CONF_DIR:$INFRA_MANAGER_LIBS_DIR/*" $INFRA_MANAGER_GC_OPTS
$INFRA_MANAGER_JAVA_OPTS $INFRA_MANAGER_JAVA_MEM org.apache.ambari.infra.InfraManager >
$LOG_FILE 2>&1 &
+  fi
+}
+
+function stop() {
+  INFRA_MANAGER_STOP_WAIT=3
+  if [ -f "$INFRA_MANAGER_PID_FILE" ]; then
+    INFRA_MANAGER_PID=`cat "$INFRA_MANAGER_PID_FILE"`
+  fi
+
+  if [ "$INFRA_MANAGER_PID" != "" ]; then
+    echo -e "Sending stop command to Infra Manager... Checking PID: $INFRA_MANAGER_PID."
+    kill $INFRA_MANAGER_PID
+      (loops=0
+      while true
+      do
+        CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $INFRA_MANAGER_PID | sort -r | tr
-d ' '`
+        if [ "$CHECK_PID" != "" ]; then
+          slept=$((loops * 2))
+          if [ $slept -lt $INFRA_MANAGER_STOP_WAIT ]; then
+            sleep 2
+            loops=$[$loops+1]
+          else
+            exit # subshell!
+          fi
+        else
+          exit # subshell!
+        fi
+      done) &
+    spinner $!
+    rm -f "$INFRA_MANAGER_PID_FILE"
+  else
+    echo -e "No Infra Manager process found to stop."
+    exit 0
+  fi
+
+  CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $INFRA_MANAGER_PID | sort -r | tr -d '
'`
+  if [ "$CHECK_PID" != "" ]; then
+    echo -e "Infra Manager process $INFRA_MANAGER_PID is still running; forcefully killing
it now."
+    kill -9 $INFRA_MANAGER_PID
+    echo "Killed process $INFRA_MANAGER_PID"
+    rm -f "$INFRA_MANAGER_PID_FILE"
+    sleep 1
+  else
+    echo "Infra Manager is stopped."
+  fi
+
+  CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $INFRA_MANAGER_PID | sort -r | tr -d '
'`
+  if [ "$CHECK_PID" != "" ]; then
+    echo "ERROR: Failed to kill Infra Manager Java process $INFRA_MANAGER_PID ... script
fails."
+    exit 1
+  fi
+}
+
+if [ $# -gt 0 ]; then
+    SCRIPT_CMD="$1"
+    shift
+else
+   print_usage
+   exit 1
 fi
 
-PATH=$JAVA_HOME/bin:$PATH nohup $JVM -classpath "/etc/ambari-infra-manager/conf:$DIR:$DIR/libs/*"
$INFRA_MANAGER_OPTS org.apache.ambari.infra.InfraManager ${1+"$@"} &
\ No newline at end of file
+case $SCRIPT_CMD in
+  start)
+    start ${1+"$@"}
+  ;;
+  stop)
+    stop
+  ;;
+  status)
+    status
+  ;;
+  help)
+    print_usage
+    exit 0
+  ;;
+  *)
+    print_usage
+    exit 1
+  ;;
+
+esac
\ No newline at end of file


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Infra Manager: install packages
> -------------------------------
>
>                 Key: AMBARI-22760
>                 URL: https://issues.apache.org/jira/browse/AMBARI-22760
>             Project: Ambari
>          Issue Type: Improvement
>          Components: ambari-infra
>    Affects Versions: 3.0.0
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>             Fix For: 3.0.0
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message