From cfabb816a54855b321d9c1ac2acdb76bb7d2652a Mon Sep 17 00:00:00 2001 From: chao long Date: Wed, 17 Apr 2019 17:27:03 +0800 Subject: [PATCH] KYLIN-3943 Fix some problems in system-cube.sh --- build/bin/build-incremental-cube.sh | 15 +++--- build/bin/system-cube.sh | 77 ++++++++++++++++++----------- 2 files changed, 55 insertions(+), 37 deletions(-) diff --git a/build/bin/build-incremental-cube.sh b/build/bin/build-incremental-cube.sh index fcc3a4faced..2d86694a7da 100644 --- a/build/bin/build-incremental-cube.sh +++ b/build/bin/build-incremental-cube.sh @@ -17,22 +17,21 @@ # limitations under the License. # -dir=$(dirname ${0}) -if [ -z "$KYLIN_HOME" ]; then - export KYLIN_HOME=${dir}/../ -fi -echo KYLIN_HOME is set to $KYLIN_HOME +source $(cd -P -- "$(dirname -- "$0")" && pwd -P)/header.sh if [ ! $1 ]; then echo "usage: build-incremental-cube.sh CUBE INTERVAL DELAY" exit 1 fi +tomcat_root=${dir}/../tomcat +export tomcat_root + CUBE=$1 INTERVAL=${2:-"3600000"} DELAY=${3:-"0"} -SERVER="localhost" -PORT="7070" + +kylin_rest_address=`hostname -f`":"`grep " ${SINK_TOOLS_FILE} + + echo "setup system cubes" + + rm -rf $SINK_TOOLS_FILE $OUTPUT_FORDER + + cat <<-EOF > ${SINK_TOOLS_FILE} [ [ "org.apache.kylin.tool.metrics.systemcube.util.HiveSinkTool", @@ -80,20 +98,21 @@ then #refresh signature $KYLIN_HOME/bin/kylin.sh org.apache.kylin.cube.cli.CubeSignatureRefresher ${SC_NAME_1},${SC_NAME_2},${SC_NAME_3},${SC_NAME_4},${SC_NAME_5} - +elif [ "$1" == "cron" ] +then #add a crontab job + echo "add to a crontab job" + CRONTAB_FILE=$KYLIN_HOME/crontabJob - cat <<-EOF > ${CRONTAB_FILE} - 0 */4 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_1} 3600000 1200000 - 20 */4 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_2} 3600000 1200000 - 40 */8 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_3} 3600000 1200000 - 30 */8 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_4} 3600000 1200000 - 50 */24 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_5} 3600000 1200000 + cat <<-EOF > ${CRONTAB_FILE} + 0 */2 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_1} 3600000 1200000 + 20 */2 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_2} 3600000 1200000 + 40 */4 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_3} 3600000 1200000 + 30 */4 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_4} 3600000 1200000 + 50 */12 * * * sh ${KYLIN_HOME}/bin/build-incremental-cube.sh ${SC_NAME_5} 3600000 1200000 EOF crontab ${CRONTAB_FILE} rm ${CRONTAB_FILE} else - echo "usage: system-cube.sh setup" - echo " system-cube.sh build" - exit 1 -fi + printHelp +fi \ No newline at end of file