diff --git a/conf/byzer.properties.all-in-one.example b/conf/byzer.properties.all-in-one.example new file mode 100644 index 000000000..eb69dcf81 --- /dev/null +++ b/conf/byzer.properties.all-in-one.example @@ -0,0 +1,15 @@ +# override example for all-in-one package + +byzer.server.mode=all-in-one + +streaming.master=local[*] +streaming.name=Byzer-lang-desktop +streaming.rest=true +streaming.thrift=false +streaming.platform=spark +streaming.spark.service=true +streaming.job.cancel=true +streaming.datalake.path=./data/ +streaming.driver.port=9003 +streaming.enableHiveSupport=false +streaming.plugin.clzznames=tech.mlsql.plugins.ds.MLSQLExcelApp,tech.mlsql.plugins.assert.app.MLSQLAssert,tech.mlsql.plugins.shell.app.MLSQLShell,tech.mlsql.plugins.ext.ets.app.MLSQLETApp,tech.mlsql.plugins.mllib.app.MLSQLMllib diff --git a/conf/byzer.properties.server.example b/conf/byzer.properties.server.example new file mode 100644 index 000000000..69609246c --- /dev/null +++ b/conf/byzer.properties.server.example @@ -0,0 +1,12 @@ +# override example for server package + +byzer.server.mode=server + +streaming.master=local[*] +streaming.name=Byzer-lang-server +streaming.rest=true +streaming.thrift=false +streaming.platform=spark +streaming.spark.service=true +streaming.driver.port=9003 +streaming.enableHiveSupport=false \ No newline at end of file diff --git a/dev/bootstrap.sh b/dev/bootstrap.sh index 263e92774..cbd95efd0 100755 --- a/dev/bootstrap.sh +++ b/dev/bootstrap.sh @@ -88,13 +88,14 @@ function prepareProp() { BYZER_PROP=$($BYZER_HOME/bin/get-properties.sh -byzer) SPARK_PROP=$($BYZER_HOME/bin/get-properties.sh -spark) + ALL_PROP=$($BYZER_HOME/bin/get-properties.sh -args) } function start(){ clearRedundantProcess # check $BYZER_HOME - [[ -z ${BYZER_HOME} ]] && quit "{BYZER_HOME} is not set, exit" + [[ -z ${BYZER_HOME} ]] && quit "{BYZER_HOME} is not set, exit" if [ -f "${BYZER_HOME}/pid" ]; then PID=$(cat ${BYZER_HOME}/pid) if ps -p $PID > /dev/null; then @@ -105,7 +106,7 @@ function start(){ # check $SPARK_HOME if [ $BYZER_SERVER_MODE == "server" ]; then # only in server mode need check spark home - [[ -z ${SPARK_HOME} ]] && quit "{SPARK_HOME} is not set, exit" + [[ -z ${SPARK_HOME} ]] && quit "{SPARK_HOME} is not set, exit" fi ${BYZER_HOME}/bin/check-env.sh || exit 1 @@ -119,23 +120,41 @@ function start(){ prepareProp echo "Starting Byzer engine in ${BYZER_SERVER_MODE} mode..." - echo "[Spark config]" - echo "$SPARK_PROP" - - echo "[Byzer config]" - echo "${BYZER_PROP}" - - echo "[Extra config]" - echo "${EXT_JARS}" cd $BYZER_HOME/ - nohup $SPARK_HOME/bin/spark-submit --class streaming.core.StreamingApp \ - --jars ${JARS} \ - --conf "spark.driver.extraClassPath=${EXT_JARS}" \ - --driver-java-options "-Dlog4j.configuration=${BYZER_LOG_PATH}" \ - $SPARK_PROP \ - $MAIN_JAR_PATH \ - $BYZER_PROP >> ${BYZER_HOME}/logs/byzer.out & echo $! >> ${BYZER_HOME}/pid + + if [[ $BYZER_SERVER_MODE = "all-in-one" ]]; then + echo "" + echo "[All Config]" + echo "${ALL_PROP}" + echo "" + + nohup ${BYZER_HOME}/jdk8/bin/java -cp ${BYZER_HOME}/main/${MAIN_JAR}:${BYZER_HOME}/spark/*:${BYZER_HOME}/libs/*:${BYZER_HOME}/plugin/* \ + tech.mlsql.example.app.LocalSparkServiceApp \ + $ALL_PROP >> ${BYZER_HOME}/logs/byzer.out & + echo $! >> ${BYZER_HOME}/pid + + elif [[ $BYZER_SERVER_MODE = "server" ]]; then + echo "" + echo "[Spark Config]" + echo "$SPARK_PROP" + + echo "[Byzer Config]" + echo "${BYZER_PROP}" + + echo "[Extra Config]" + echo "${EXT_JARS}" + echo "" + + nohup $SPARK_HOME/bin/spark-submit --class streaming.core.StreamingApp \ + --jars ${JARS} \ + --conf "spark.driver.extraClassPath=${EXT_JARS}" \ + --driver-java-options "-Dlog4j.configuration=${BYZER_LOG_PATH}" \ + $SPARK_PROP \ + $MAIN_JAR_PATH \ + $BYZER_PROP >> ${BYZER_HOME}/logs/byzer.out & + echo $! >> ${BYZER_HOME}/pid + fi sleep 3 clearRedundantProcess @@ -146,7 +165,9 @@ function start(){ CUR_DATE=$(date "+%Y-%m-%d %H:%M:%S") echo $CUR_DATE" new Byzer engine process pid is "$PID >> ${BYZER_HOME}/logs/byzer-lang.log - echo "Byzer engine is starting. It may take a while. For status, please visit http://$BYZER_IP:$BYZER_LANG_PORT." + echo "" + echo $(setColor 33 "Byzer engine is starting. It may take a while. For status, please visit http://$BYZER_IP:$BYZER_LANG_PORT.") + echo "" echo "You may also check status via: PID:$(cat ${BYZER_HOME}/pid), or Log: ${BYZER_HOME}/logs/byzer-lang.log." recordStartOrStop "start success" "${START_TIME}" } diff --git a/streamingpro-assembly/src/main/assembly/assembly.xml b/streamingpro-assembly/src/main/assembly/assembly.xml index c3b41b6dd..47ec61403 100644 --- a/streamingpro-assembly/src/main/assembly/assembly.xml +++ b/streamingpro-assembly/src/main/assembly/assembly.xml @@ -51,6 +51,8 @@ byzer.properties byzer.properties.override + byzer.properties.all-in-one.example + byzer.properties.server.example byzer-server-log4j.properties byzer-tools-log4j.properties diff --git a/streamingpro-commons/src/main/java/tech/mlsql/tool/ByzerConfigCLI.java b/streamingpro-commons/src/main/java/tech/mlsql/tool/ByzerConfigCLI.java index 5920b4bf2..7857d8b8f 100644 --- a/streamingpro-commons/src/main/java/tech/mlsql/tool/ByzerConfigCLI.java +++ b/streamingpro-commons/src/main/java/tech/mlsql/tool/ByzerConfigCLI.java @@ -30,6 +30,8 @@ public class ByzerConfigCLI { private final static String BYZER_CONF_TEMP = "-%s %s"; + private final static String ARGS_CONF_TEMP = "-%s %s "; + public static void main(String[] args) { execute(args); Unsafe.systemExit(0); @@ -51,7 +53,7 @@ public static void execute(String[] args) { String key = args[0].trim(); if (key.equals("-byzer")) { - // get all properties + // get byzer properties for (Map.Entry entry : config.entrySet()) { String entryKey = (String) entry.getKey(); if (entryKey.startsWith("streaming") || entryKey.startsWith("spark.mlsql")) { @@ -60,7 +62,7 @@ public static void execute(String[] args) { } } } else if (key.equals("-spark")) { - // get all properties + // get spark properties for (Map.Entry entry : config.entrySet()) { String entryKey = (String) entry.getKey(); if (entryKey.startsWith("spark") && !entryKey.startsWith("spark.mlsql")) { @@ -68,7 +70,16 @@ public static void execute(String[] args) { System.out.println(prop); } } - } else if (!key.endsWith(".")) { + } else if ("-args".equals(key)) { + // get all properties + StringBuffer prop = new StringBuffer(""); + for (Map.Entry entry : config.entrySet()) { + String entryKey = (String) entry.getKey(); + prop.append(String.format(ARGS_CONF_TEMP, entryKey, entry.getValue())); + } + System.out.println(prop); + } + else if (!key.endsWith(".")) { String value = config.getProperty(key); if (value == null) { value = "";