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 22:33:47 UTC
svn commit: r1130857 - in /incubator/hcatalog/trunk: 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 22:33:47 2011
New Revision: 1130857
URL: http://svn.apache.org/viewvc?rev=1130857&view=rev
Log:
HCATALOG-27: Start and stop scripts for the server
Added:
incubator/hcatalog/trunk/scripts/hcat_server_start.sh (with props)
incubator/hcatalog/trunk/scripts/hcat_server_stop.sh (with props)
Modified:
incubator/hcatalog/trunk/CHANGES.txt
incubator/hcatalog/trunk/build.xml
incubator/hcatalog/trunk/scripts/hcat_server_install.sh
Modified: incubator/hcatalog/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1130857&r1=1130856&r2=1130857&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Thu Jun 2 22:33:47 2011
@@ -12,6 +12,8 @@ Trunk (unreleased changes)
(Krishna Kumar via macyang)
IMPROVEMENTS
+ HCAT-27. Start and stop scripts for the server (gates)
+
HCAT-21. Install documenation and script (gates)
HCAT-34. Add ant target for server side classes (hashutosh)
Modified: incubator/hcatalog/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/build.xml?rev=1130857&r1=1130856&r2=1130857&view=diff
==============================================================================
--- incubator/hcatalog/trunk/build.xml (original)
+++ incubator/hcatalog/trunk/build.xml Thu Jun 2 22:33:47 2011
@@ -476,7 +476,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/trunk/scripts/hcat_server_install.sh
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/scripts/hcat_server_install.sh?rev=1130857&r1=1130856&r2=1130857&view=diff
==============================================================================
--- incubator/hcatalog/trunk/scripts/hcat_server_install.sh (original)
+++ incubator/hcatalog/trunk/scripts/hcat_server_install.sh Thu Jun 2 22:33:47 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/trunk/scripts/hcat_server_start.sh
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/scripts/hcat_server_start.sh?rev=1130857&view=auto
==============================================================================
--- incubator/hcatalog/trunk/scripts/hcat_server_start.sh (added)
+++ incubator/hcatalog/trunk/scripts/hcat_server_start.sh Thu Jun 2 22:33:47 2011
@@ -0,0 +1,97 @@
+#!/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 HADOOP_HOME=$HADOOP_HOME
+#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=2048 # 8G is better if you have it
+
+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
+
Propchange: incubator/hcatalog/trunk/scripts/hcat_server_start.sh
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/hcatalog/trunk/scripts/hcat_server_stop.sh
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/scripts/hcat_server_stop.sh?rev=1130857&view=auto
==============================================================================
--- incubator/hcatalog/trunk/scripts/hcat_server_stop.sh (added)
+++ incubator/hcatalog/trunk/scripts/hcat_server_stop.sh Thu Jun 2 22:33:47 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
Propchange: incubator/hcatalog/trunk/scripts/hcat_server_stop.sh
------------------------------------------------------------------------------
svn:executable = *