sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-990: Sqoop2: Allow users to override Sqoop2's default http port and admin port
Date Sat, 20 Apr 2013 20:30:39 GMT
Updated Branches:
  refs/heads/sqoop2 c4467c677 -> fbd238627


SQOOP-990: Sqoop2: Allow users to override Sqoop2's default http port and admin port

(Mark Grover via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/fbd23862
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/fbd23862
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/fbd23862

Branch: refs/heads/sqoop2
Commit: fbd238627f329ffee980365f7695c50fa1d9576b
Parents: c4467c6
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Sat Apr 20 13:29:54 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Sat Apr 20 13:29:54 2013 -0700

----------------------------------------------------------------------
 dist/src/main/bin/sqoop-sys.sh       |   43 +++++++++++++++++++++++++++++
 dist/src/main/bin/sqoop.sh           |   42 +++++++++++++++++++++++++++-
 dist/src/main/server/bin/setenv.sh   |   11 +++++++
 dist/src/main/server/conf/server.xml |    4 +-
 4 files changed, 97 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/fbd23862/dist/src/main/bin/sqoop-sys.sh
----------------------------------------------------------------------
diff --git a/dist/src/main/bin/sqoop-sys.sh b/dist/src/main/bin/sqoop-sys.sh
new file mode 100644
index 0000000..64dd0bf
--- /dev/null
+++ b/dist/src/main/bin/sqoop-sys.sh
@@ -0,0 +1,43 @@
+#!/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.
+#
+
+function print() {
+  if [ "${ECHO}" != "false" ]; then
+    echo "$@"
+  fi
+}
+
+ECHO="true"
+if [ "${1}" == "-silent" ]; then
+  ECHO="false"
+fi
+
+if [ "${SQOOP_HTTP_PORT}" = "" ]; then
+  export SQOOP_HTTP_PORT=12000
+  print "Setting SQOOP_HTTP_PORT:     ${SQOOP_HTTP_PORT}"
+else
+  print "Using   SQOOP_HTTP_PORT:     ${SQOOP_HTTP_PORT}"
+fi
+
+if [ "${SQOOP_ADMIN_PORT}" = "" ]; then
+  export SQOOP_ADMIN_PORT=`expr $SQOOP_HTTP_PORT +  1`
+  print "Setting SQOOP_ADMIN_PORT:     ${SQOOP_ADMIN_PORT}"
+else
+  print "Using   SQOOP_ADMIN_PORT:     ${SQOOP_ADMIN_PORT}"
+fi

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fbd23862/dist/src/main/bin/sqoop.sh
----------------------------------------------------------------------
diff --git a/dist/src/main/bin/sqoop.sh b/dist/src/main/bin/sqoop.sh
index f1711ee..a218441 100755
--- a/dist/src/main/bin/sqoop.sh
+++ b/dist/src/main/bin/sqoop.sh
@@ -37,6 +37,19 @@ echo "Sqoop home directory: ${CUR_DIR}..."
 CATALINA_BIN=${CATALINA_BIN:-server/bin}
 CLIENT_LIB=${CLIENT_LIB:-client/lib}
 
+setup_catalina_opts() {
+  # The Java System properties 'sqoop.http.port' and 'sqoop.admin.port' are
+  # not used by Sqoop. They are used in Tomcat's server.xml configuration file
+  echo "Using   CATALINA_OPTS:       ${CATALINA_OPTS}"
+
+  catalina_opts="-Dsqoop.http.port=${SQOOP_HTTP_PORT}";
+  catalina_opts="${catalina_opts} -Dsqoop.admin.port=${SQOOP_ADMIN_PORT}";
+
+  echo "Adding to CATALINA_OPTS:    ${catalina_opts}"
+
+  export CATALINA_OPTS="${CATALINA_OPTS} ${catalina_opts}"
+}
+
 COMMAND=$1
 case $COMMAND in
   server)
@@ -45,7 +58,34 @@ case $COMMAND in
       exit
     fi
     actionCmd=$2
-    # Remove the first 2 command line arguments so we can pass
+
+    # resolve links - $0 may be a softlink
+    PRG="${0}"
+
+    while [ -h "${PRG}" ]; do
+      ls=`ls -ld "${PRG}"`
+      link=`expr "$ls" : '.*-> \(.*\)$'`
+      if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+      else
+        PRG=`dirname "${PRG}"`/"$link"
+      fi
+    done
+
+    BASEDIR=`dirname ${PRG}`
+    BASEDIR=`cd ${BASEDIR}/..;pwd`
+
+    source ${BASEDIR}/bin/sqoop-sys.sh
+    setup_catalina_opts
+
+    # There seems to be a bug in catalina.sh whereby catalina.sh doesn't respect
+    # CATALINA_OPTS when stopping the tomcat server. Consequently, we have to hack around
+    # by specifying the CATALINA_OPTS properties in JAVA_OPTS variable
+    if [ "$actionCmd" == "stop" ]; then
+      export JAVA_OPTS="$JAVA_OPTS $CATALINA_OPTS"
+    fi
+
+    # Remove the first 2 command line arguments (server and action command (start/stop))
so we can pass
     # the rest to catalina.sh script
     shift
     shift

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fbd23862/dist/src/main/server/bin/setenv.sh
----------------------------------------------------------------------
diff --git a/dist/src/main/server/bin/setenv.sh b/dist/src/main/server/bin/setenv.sh
index 607427e..815c974 100755
--- a/dist/src/main/server/bin/setenv.sh
+++ b/dist/src/main/server/bin/setenv.sh
@@ -14,4 +14,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+
+# Set Sqoop specific environment variables here
+
 JAVA_OPTS="$JAVA_OPTS -Dsqoop.config.dir=`dirname $0`/../conf"
+
+# The port Sqoop server runs
+#
+# export SQOOP_HTTP_PORT=12000
+
+# Sqoop Admin port
+#
+# export SQOOP_ADMIN_PORT=12001

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fbd23862/dist/src/main/server/conf/server.xml
----------------------------------------------------------------------
diff --git a/dist/src/main/server/conf/server.xml b/dist/src/main/server/conf/server.xml
index 3206cce..a946da4 100644
--- a/dist/src/main/server/conf/server.xml
+++ b/dist/src/main/server/conf/server.xml
@@ -19,7 +19,7 @@
      define subcomponents such as "Valves" at this level.
      Documentation at /docs/config/server.html
  -->
-<Server port="12001" shutdown="SHUTDOWN">
+<Server port="${sqoop.admin.port}" shutdown="SHUTDOWN">
 
   <!--APR library loader. Documentation at /docs/apr.html -->
   <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
@@ -66,7 +66,7 @@
          APR (HTTP/AJP) Connector: /docs/apr.html
          Define a non-SSL HTTP/1.1 Connector on port 8080
     -->
-    <Connector port="12000" protocol="HTTP/1.1"
+    <Connector port="${sqoop.http.port}" protocol="HTTP/1.1"
                connectionTimeout="20000"
                redirectPort="8443" />
     <!-- A "Connector" using the shared thread pool-->


Mime
View raw message