You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hcatalog-commits@incubator.apache.org by ga...@apache.org on 2011/06/02 23:10:40 UTC
svn commit: r1130869 - in /incubator/hcatalog/branches/branch-0.1:
CHANGES.txt build.xml scripts/hcat_server_install.sh
scripts/hcat_server_start.sh scripts/hcat_server_stop.sh
Author: gates
Date: Thu Jun 2 23:10:39 2011
New Revision: 1130869
URL: http://svn.apache.org/viewvc?rev=1130869&view=rev
Log:
HCATALOG-27. Start and stop scripts for the server
Added:
incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_start.sh
incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_stop.sh
Modified:
incubator/hcatalog/branches/branch-0.1/CHANGES.txt
incubator/hcatalog/branches/branch-0.1/build.xml
incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_install.sh
Modified: incubator/hcatalog/branches/branch-0.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.1/CHANGES.txt?rev=1130869&r1=1130868&r2=1130869&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.1/CHANGES.txt (original)
+++ incubator/hcatalog/branches/branch-0.1/CHANGES.txt Thu Jun 2 23:10:39 2011
@@ -43,6 +43,7 @@ Release 0.1 - Unreleased
HCAT-9. Get a beginning HCatalog website up. (gates)
IMPROVEMENTS
+ HCAT-27. Start and stop scripts for the server (gates)
HCAT-21. Install documenation and script (gates)
Modified: incubator/hcatalog/branches/branch-0.1/build.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.1/build.xml?rev=1130869&r1=1130868&r2=1130869&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.1/build.xml (original)
+++ incubator/hcatalog/branches/branch-0.1/build.xml Thu Jun 2 23:10:39 2011
@@ -433,7 +433,9 @@
<copy todir="${dist.dir}/scripts">
<fileset file="hive/external/metastore/scripts/upgrade/mysql/hive-schema-0.7.0.mysql.sql"/>
- <fileset file="scripts/hcat_server_install.sh"/>
+ <fileset dir="scripts">
+ <include name="*.sh"/>
+ </fileset>
</copy>
<copy todir="${dist.dir}/src" includeEmptyDirs="true">
Modified: incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_install.sh
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_install.sh?rev=1130869&r1=1130868&r2=1130869&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_install.sh (original)
+++ incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_install.sh Thu Jun 2 23:10:39 2011
@@ -106,12 +106,17 @@ for dir in var conf var/log bin lib ; do
done
# Move files into the appropriate directories
-for dir in conf lib ; do
+for dir in bin conf lib ; do
for file in ./$dir/* ; do
- cp $file $root/$dir
+ cp -R $file $root/$dir
done
done
+# Put the start and stop scripts into bin
+for file in hcat_server_start.sh hcat_server_stop.sh ; do
+ cp scripts/$file $root/bin
+done
+
# Move the proto-hive-site.xml to hive-site.xml
cp $root/conf/proto-hive-site.xml $root/conf/hive-site.xml
Added: incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_start.sh
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_start.sh?rev=1130869&view=auto
==============================================================================
--- incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_start.sh (added)
+++ incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_start.sh Thu Jun 2 23:10:39 2011
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+# 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.
+
+
+# Resolve our absolute path
+# resolve links - $0 may be a softlink
+this="${BASH_SOURCE-$0}"
+while [ -h "$this" ]; do
+ ls=`ls -ld "$this"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ this="$link"
+ else
+ this=`dirname "$this"`/"$link"
+ fi
+done
+
+# convert relative path to absolute path
+bin=`dirname "$this"`
+script=`basename "$this"`
+bin=`unset CDPATH; cd "$bin"; pwd`
+this="$bin/$script"
+
+# the root of the HCatalog installation
+export HCAT_HOME=`dirname "$this"`/..
+
+# Read the env file created by the install script
+. $HCAT_HOME/conf/hcat-env.sh
+
+# back ground the metastore service and record the pid
+
+PID_FILE=${ROOT}/var/log/hcat.pid
+SLEEP_TIME_AFTER_START=15
+
+# check if service is already running, if so exit
+if [ -s "$PID_FILE" ]
+then
+ echo "HCatalog server appears to be running. If you are SURE it is not" \
+ " remove $PID_FILE and re-run this script."
+ exit 1
+fi
+
+# add mysqldb jars
+for f in ${DBROOT}/mysql-connector-java-*-bin.jar; do
+ AUX_CLASSPATH=${AUX_CLASSPATH}:$f
+done
+
+# add jars from lib dir
+for f in ${ROOT}/lib/*.jar ; do
+ AUX_CLASSPATH=${AUX_CLASSPATH}:$f
+done
+
+# echo AUX_CLASSPATH = ${AUX_CLASSPATH}
+export AUX_CLASSPATH=${AUX_CLASSPATH}
+
+
+#export METASTORE_PORT=$hcat_server_port
+export HADOOP_HOME=$HADOOP_HOME
+#export HADOOP_CONF_DIR=$HADOOP_CONF_DIR # get from package yinst setting
+#export HADOOP_OPTS="-Dlog4j.configuration=file://${ROOT}/conf/log4j.properties"
+export HADOOP_OPTS="${HADOOP_OPTS} -server -XX:+UseConcMarkSweepGC -XX:ErrorFile=${ROOT}/var/log/hcat_err_pid%p.log -Xloggc:${ROOT}/var/log/hcat_gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps"
+export HADOOP_HEAPSIZE=8192
+
+#export HADOOP_OVERRIDE=${ROOT}/bin/hadoop.local
+
+nohup ${ROOT}/bin/hive --service metastore >${ROOT}/var/log/hcat.out 2>${ROOT}/var/log/hcat.err &
+
+PID=$!
+
+if [ "${PID}x" == "x" ] ; then # we failed right off
+ echo "Metastore startup failed, see $ROOT/var/log/hcat.err"
+ exit 1
+fi
+
+echo Started metastore server init, testing if initialized correctly...
+sleep $SLEEP_TIME_AFTER_START
+
+if ps -p $PID > /dev/null
+then
+ echo $PID > $PID_FILE
+ echo "Metastore initialized successfully."
+else
+ echo "Metastore startup failed, see $ROOT/var/log/hcat.err"
+ exit 1
+fi
+
Added: incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_stop.sh
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_stop.sh?rev=1130869&view=auto
==============================================================================
--- incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_stop.sh (added)
+++ incubator/hcatalog/branches/branch-0.1/scripts/hcat_server_stop.sh Thu Jun 2 23:10:39 2011
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# 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.
+
+# Resolve our absolute path
+# resolve links - $0 may be a softlink
+this="${BASH_SOURCE-$0}"
+while [ -h "$this" ]; do
+ ls=`ls -ld "$this"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ this="$link"
+ else
+ this=`dirname "$this"`/"$link"
+ fi
+done
+
+# convert relative path to absolute path
+bin=`dirname "$this"`
+script=`basename "$this"`
+bin=`unset CDPATH; cd "$bin"; pwd`
+this="$bin/$script"
+
+# the root of the HCatalog installation
+export HCAT_HOME=`dirname "$this"`/..
+
+# Read the env file created by the install script
+. $HCAT_HOME/conf/hcat-env.sh
+
+PID_FILE=${ROOT}/var/log/hcat.pid
+SLEEP_TIME_AFTER_KILL=30
+
+echo looking for $PID_FILE
+
+# check if service is already running, if so exit
+if [ -s "$PID_FILE" ] ; then
+ PID=`cat $PID_FILE`
+ echo "Found metastore server process $PID, killing..."
+ kill $PID
+ sleep $SLEEP_TIME_AFTER_KILL
+
+ # if process is still around, use kill -9
+ if ps -p $PID > /dev/null ; then
+ echo "Initial kill failed, getting serious now..."
+ kill -9 $PID
+ fi
+ if ps -p $PID > /dev/null ; then
+ echo "Wow, even kill -9 failed, giving up; sorry"
+ else
+ rm -rf $PID_FILE
+ echo "Successfully shutdown metastore"
+ fi
+fi