You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/02/12 06:43:03 UTC

[13/50] incubator-kylin git commit: fix .gitignore

fix .gitignore


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

Branch: refs/heads/inverted-index
Commit: cb1de27c14103e16dba7f33af03fdff1ada996a5
Parents: c94519a
Author: qianhao.zhou <qi...@ebay.com>
Authored: Tue Feb 10 17:30:16 2015 +0800
Committer: qianhao.zhou <qi...@ebay.com>
Committed: Tue Feb 10 17:30:16 2015 +0800

----------------------------------------------------------------------
 .gitignore                  |  1 -
 bin/check-env.sh            | 39 ++++++++++++++++++++++++++
 bin/find-hive-dependency.sh | 20 ++++++++++++++
 bin/healthmon.sh            | 33 ++++++++++++++++++++++
 bin/start-kylin.sh          | 59 ++++++++++++++++++++++++++++++++++++++++
 bin/stop-kylin.sh           |  4 +++
 6 files changed, 155 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cb1de27c/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 4d4bf12..6649d69 100755
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,6 @@
 *.pydevproject
 .metadata
 .gradle
-bin/
 tmp/
 *.tmp
 *.bak

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cb1de27c/bin/check-env.sh
----------------------------------------------------------------------
diff --git a/bin/check-env.sh b/bin/check-env.sh
new file mode 100755
index 0000000..3bef6c4
--- /dev/null
+++ b/bin/check-env.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+echo "Checking KYLIN_HOME..."
+if [ -z "$KYLIN_HOME" ]
+then
+    echo 'please make sure KYLIN_HOME has been set'
+    exit 1
+else
+    echo "KYLIN_HOME is set to ${KYLIN_HOME}"
+fi
+
+echo "Checking hbase..."
+if [ -z "$(command -v hbase version)" ]
+then
+    echo "Please make sure the user has the privilege to run hbase shell"
+    exit 1
+else
+    echo "hbase check passed"
+fi
+
+echo "Checking hive..."
+if [ -z "$(command -v hive --version)" ]
+then
+    echo "Please make sure the user has the privilege to run hive shell"
+    exit 1
+else
+    echo "hive check passed"
+fi
+
+echo "Checking hadoop..."
+if [ -z "$(command -v hadoop version)" ]
+then
+    echo "Please make sure the user has the privilege to run hadoop shell"
+    exit 1
+else
+    echo "hadoop check passed"
+fi
+
+exit 0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cb1de27c/bin/find-hive-dependency.sh
----------------------------------------------------------------------
diff --git a/bin/find-hive-dependency.sh b/bin/find-hive-dependency.sh
new file mode 100644
index 0000000..7bd5f43
--- /dev/null
+++ b/bin/find-hive-dependency.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+hive_env=`hive -e set | grep 'env:CLASSPATH'`
+
+hive_classpath=`echo $hive_env | grep 'env:CLASSPATH' | awk -F '=' '{print $2}'`
+arr=(`echo $hive_classpath | cut -d ":"  --output-delimiter=" " -f 1-`)
+hive_exec_path=
+for data in ${arr[@]}
+do
+    result=`echo $data | grep 'hive-exec.jar'`
+    if [ $result ]
+    then
+        hive_exec_path=$data
+    fi
+done
+hdp_home=`echo $hive_exec_path | awk -F '/hive/lib/' '{print $1}'`
+
+hive_dependency=/usr/hdp/current/hive-client/conf/:${hdp_home}/hive/lib/*:${hdp_home}/hive-hcatalog/share/hcatalog/*
+echo "hive dependency: $hive_dependency"
+export hive_dependency
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cb1de27c/bin/healthmon.sh
----------------------------------------------------------------------
diff --git a/bin/healthmon.sh b/bin/healthmon.sh
new file mode 100644
index 0000000..439eef4
--- /dev/null
+++ b/bin/healthmon.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+ALERT="your@email.com"
+
+OUTPUT=$(
+	curl --max-time 20 -# \
+	--data '{"sql":"select count(*) from test_kylin_fact","offset":0,"limit":50000,"acceptPartial":true,"project":"default"}' \
+	-H "Authorization:Basic QURNSU46S1lMSU4=" \
+	-H "Content-Type:application/json;charset=UTF-8" \
+	http://localhost:7070/kylin/api/query \
+)
+
+# ----------------------------------------------------------------------------
+
+date
+
+if [[ $OUTPUT == *"results"* ]]; then
+	echo "Good."
+else
+	echo "Bad."
+	TS_FILE=/tmp/kylin_healthmon_ts
+	LAST_TS=`stat -c%Y $TS_FILE 2>/dev/null`
+	CURR_TS=`date +%s`
+	echo last: $LAST_TS
+	echo curr: $CURR_TS
+	if (( ${LAST_TS:-"0"} < $CURR_TS - 3600 )); then
+		echo "Sending mail..."
+		echo "Kylin Prod health check failed as of $(date)." | mail -s "KYLIN PROD DOWN" $ALERT
+		if [ "$?" == "0" ]; then
+			touch $TS_FILE
+		fi
+	fi
+fi

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cb1de27c/bin/start-kylin.sh
----------------------------------------------------------------------
diff --git a/bin/start-kylin.sh b/bin/start-kylin.sh
new file mode 100755
index 0000000..d328851
--- /dev/null
+++ b/bin/start-kylin.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+dir=$(dirname ${0})
+
+tomcat_root=${dir}/../tomcat
+export tomcat_root
+
+sh ${dir}/check-env.sh || { exit 1; }
+
+#if [ ! -z "$KYLIN_LD_LIBRARY_PATH" ]
+#then
+#    echo "KYLIN_LD_LIBRARY_PATH is set to $KYLIN_LD_LIBRARY_PATH"
+#else
+#    exit 1
+#fi
+
+#The location of all hadoop/hbase configurations are difficult to get.
+#Plus, some of the system properties are secretly set in hadoop/hbase shell command.
+#For example, in hdp 2.2, there is a system property called hdp.version,
+#which we cannot get until running hbase or hadoop shell command.
+#
+#To save all these troubles, we use hbase runjar to start tomcat.
+#In this way we no longer need to explicitly configure hadoop/hbase related classpath for tomcat,
+#hbase command will do all the dirty tasks for us:
+
+#-Djava.library.path=${KYLIN_LD_LIBRARY_PATH} \
+
+
+useSandbox=`cat ${KYLIN_HOME}/conf/kylin.properties | grep 'kylin.sandbox' | awk -F '=' '{print $2}'`
+spring_profile="default"
+if [ "$useSandbox" -eq true ]
+    then spring_profile="sandbox"
+fi
+rm -rf ${tomcat_root}/webapps/kylin*
+cp ${dir}/../lib/kylin-server-*.war ${tomcat_root}/webapps/kylin.war
+
+source ${dir}/find-hive-dependency.sh
+
+export HBASE_CLASSPATH_PREFIX=${tomcat_root}/bin/bootstrap.jar:${tomcat_root}/bin/tomcat-juli.jar:${tomcat_root}/lib/*:$HBASE_CLASSPATH_PREFIX
+export HBASE_CLASSPATH=$hive_dependency:${HBASE_CLASSPATH}
+
+hbase -Djava.util.logging.config.file=${tomcat_root}/conf/logging.properties \
+-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
+-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true \
+-Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true \
+-Djava.endorsed.dirs=${tomcat_root}/endorsed  \
+-Dcatalina.base=${tomcat_root} \
+-Dcatalina.home=${tomcat_root} \
+-Djava.io.tmpdir=${tomcat_root}/temp  \
+-Dkylin.hive.dependency=${hive_dependency} \
+-Dspring.profiles.active=${spring_profile} \
+org.apache.hadoop.util.RunJar ${tomcat_root}/bin/bootstrap.jar  org.apache.catalina.startup.Bootstrap start > ${tomcat_root}/logs/kylin_sandbox.log 2>&1 &
+echo "A new Kylin instance is started by $USER, stop it using \"stop-kylin.sh\""
+if [ "$useSandbox" -eq true ]
+    then echo "Please visit http://<your_sandbox_ip>:7070/kylin to play with the cubes! (Useranme: ADMIN, Password: KYLIN)"
+else
+    echo "Please visit http://<ip>:7070/kylin"
+fi
+echo "You can check the log at ${tomcat_root}/logs/kylin_sandbox.log"

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cb1de27c/bin/stop-kylin.sh
----------------------------------------------------------------------
diff --git a/bin/stop-kylin.sh b/bin/stop-kylin.sh
new file mode 100755
index 0000000..806513b
--- /dev/null
+++ b/bin/stop-kylin.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+ps -fu $USER | grep tomcat | grep -v "grep" | awk '{print $2}' | xargs kill
+echo "all tomcats started by $USER are killed"
\ No newline at end of file