Skip to content

Commit 03ab05a

Browse files
committed
[chunjun-server] add session monitor, and auto deploy session,add rest-api (submit job, get job status, get job log)
1 parent 8d80354 commit 03ab05a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+6638
-0
lines changed

bin/start-server.sh

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
#set -x
21+
22+
export CHUNJUN_HOME="$(cd "`dirname "$0"`"/..; pwd)"
23+
echo "CHUNJUN_HOME:"$CHUNJUN_HOME >&2
24+
25+
cd $CHUNJUN_HOME
26+
HO_HEAP_SIZE="${HO_HEAP_SIZE:=1024m}"
27+
28+
JAVA_OPTS="$JAVA_OPTS -Xmx${HO_HEAP_SIZE}"
29+
#JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=10006"
30+
31+
JAVA_OPTS="$JAVA_OPTS -Xms${HO_HEAP_SIZE}"
32+
33+
JAVA_OPTS="$JAVA_OPTS -server"
34+
35+
JAVA_OPTS="$JAVA_OPTS -Xloggc:../logs/node.gc"
36+
37+
JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=../logs/heapdump.hprof"
38+
39+
JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps"
40+
41+
#JAVA_OPTS="$JAVA_OPTS -Djava.io.tmpdir=./tmpSave"
42+
CHUNJUN_NICE=19
43+
CHUNJUN_LOG_DIR=$CHUNJUN_HOME/logs
44+
pidfile=$CHUNJUN_HOME/run/chunjun.pid
45+
46+
if [ ! -d "$CHUNJUN_LOG_DIR" ]; then
47+
mkdir $CHUNJUN_LOG_DIR
48+
fi
49+
50+
if [ ! -e "$pidfile" ]; then
51+
mkdir $CHUNJUN_HOME/run
52+
fi
53+
54+
55+
56+
# Find the java binary
57+
if [ -n "${JAVA_HOME}" ]; then
58+
JAVA_RUN="${JAVA_HOME}/bin/java"
59+
else
60+
if [ `command -v java` ]; then
61+
JAVA_RUN="java"
62+
else
63+
echo "JAVA_HOME is not set" >&2
64+
exit 1
65+
fi
66+
fi
67+
68+
if [ -n "$HADOOP_USER_NAME" ]; then
69+
echo "HADOOP_USER_NAME is "$HADOOP_USER_NAME
70+
else
71+
HADOOP_USER_NAME=yarn
72+
echo "set HADOOP_USER_NAME as yarn"
73+
export HADOOP_USER_NAME
74+
fi
75+
76+
JAR_DIR=$CHUNJUN_HOME/server/*:$CHUNJUN_HOME/*.jar:$CHUNJUN_HOME/conf/*
77+
echo $JAR_DIR
78+
CLASS_NAME=com.dtstack.chunjun.server.ServerLauncher
79+
80+
start(){
81+
echo "ChunJun server starting ..."
82+
nice -n ${CHUNJUN_NICE} $JAVA_RUN $JAVA_OPTS -cp $JAR_DIR $CLASS_NAME $@ 1> "${CHUNJUN_LOG_DIR}/chunjun.stdout" 2>&1 &
83+
echo $! > $pidfile
84+
ret=$?
85+
return 0
86+
}
87+
88+
status() {
89+
if [ -f "$pidfile" ] ; then
90+
pid=`cat "$pidfile"`
91+
if kill -0 $pid > /dev/null 2> /dev/null ; then
92+
# process by this pid is running.
93+
# It may not be our pid, but that's what you get with just pidfiles.
94+
# TODO(sissel): Check if this process seems to be the same as the one we
95+
# expect. It'd be nice to use flock here, but flock uses fork, not exec,
96+
# so it makes it quite awkward to use in this case.
97+
return 0
98+
else
99+
return 2 # program is dead but pid file exists
100+
fi
101+
else
102+
return 3
103+
fi
104+
}
105+
106+
107+
stop() {
108+
echo -n "Stoping chunjun server "
109+
# Try a few times to kill TERM the program
110+
if status ; then
111+
pid=`cat "$pidfile"`
112+
echo "Killing chunjun (pid $pid) with SIGTERM"
113+
kill -TERM $pid
114+
# Wait for it to exit.
115+
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30; do
116+
echo "Waiting chunjun (pid $pid) to die..."
117+
status || break
118+
sleep 1
119+
done
120+
if status ; then
121+
if [ "$KILL_ON_STOP_TIMEOUT" == "1" ] ; then
122+
echo "Timeout reached. Killing chunjun (pid $pid) with SIGKILL. This may result in data loss."
123+
kill -KILL $pid
124+
echo "chunjun killed with SIGKILL."
125+
else
126+
echo "chunjun stop failed; still running."
127+
return 1 # stop timed out and not forced
128+
fi
129+
else
130+
echo -n "chunjun stopped "
131+
fi
132+
fi
133+
ret=$?
134+
[ $ret -eq 0 ] ; echo "stop success"
135+
136+
}
137+
138+
case "$1" in
139+
start)
140+
echo "start"
141+
status
142+
code=$?
143+
if [ $code -eq 0 ]; then
144+
echo "chunjun server is already running"
145+
else
146+
start
147+
code=$?
148+
fi
149+
exit $code
150+
;;
151+
status)
152+
status
153+
code=$?
154+
if [ $code -eq 0 ];then
155+
echo "chunjun is already running"
156+
else
157+
echo "chunjun is not running"
158+
fi
159+
exit $code
160+
;;
161+
stop)
162+
stop
163+
;;
164+
*)
165+
echo "!!! only support 'start' 'status' 'stop' operator."
166+
esac
167+
exit $?

chunjun-restore/chunjun-restore-mysql/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@
102102
</excludes>
103103
</filter>
104104
</filters>
105+
106+
<relocations>
107+
<relocation>
108+
<pattern>com.google.common</pattern>
109+
<shadedPattern>shade.core.com.google.common</shadedPattern>
110+
</relocation>
111+
</relocations>
105112
</configuration>
106113
</execution>
107114
</executions>

0 commit comments

Comments
 (0)