Skip to content

Commit

Permalink
opt start script
Browse files Browse the repository at this point in the history
  • Loading branch information
SelfImpr001 committed Oct 5, 2020
1 parent 9dc27f9 commit ea19721
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 44 deletions.
12 changes: 4 additions & 8 deletions azkaban-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,14 @@
<version>${dropwizard.core.version}</version>
</dependency>
<dependency>
<groupId>org.forgerock.opendj</groupId>
<groupId>org.openidentityplatform.opendj</groupId>
<artifactId>opendj-grizzly</artifactId>
<version>3.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/extlib/opendj-grizzly-3.0.0.jar</systemPath>
<version>${opendjcore.version}</version>
</dependency>
<dependency>
<groupId>org.forgerock.opendj</groupId>
<groupId>org.openidentityplatform.opendj</groupId>
<artifactId>opendj-core</artifactId>
<version>3.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/extlib/opendj-core-3.0.0.jar</systemPath>
<version>${opendjcore.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,15 @@ function start(){
LOG INFO "Starting AzkabanExecutorServer on port $executorport ..."
java $AZKABAN_OPTS $JAVA_LIB_PATH -cp $CLASSPATH azkaban.execapp.AzkabanExecutorServer -conf $conf $@ >> $logFile 2>&1 &
echo $! > $azkaban_dir/currentpid
LOG INFO "AzkabanExecutorServer started successfully."
sleep 3s
processName=`jps|grep AzkabanExecutorServer`
if [ ! -n "$processName" ]
then
LOG INFO "AzkabanExecutorServer startup failed"
return 1
else
return 0
fi
}

function genServerId(){
Expand All @@ -121,43 +129,35 @@ function updataExecutorStatus(){
LOG INFO "start update executor status..."
LOCAL_HOSTNAME="`hostname`"
local azkabanConf=$azkaban_dir/conf/azkaban.properties
HOSTNAME=`getValue "mysql.host" $azkabanConf`
PORT=`getValue "mysql.port" $azkabanConf`
DATABASE=`getValue "mysql.database" $azkabanConf`
USERNAME=`getValue "mysql.user" $azkabanConf`
PASSWORD=`getValue "mysql.password" $azkabanConf "mysql.password=" | base64 -d`

select_sql="select count(*) as num from executors where host='${LOCAL_HOSTNAME}'"
EXECUTOR_PORT=`getValue "executor.port" $azkabanConf`
start_finish=0
runtime=0
while [[ $start_finish != 1 ]]; do
start_finish=`mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DATABASE} -e "${select_sql}" --default-character-set=UTF8`
start_finish=${start_finish[0]:4}
LOG INFO " 更新数据库执行节点记录成功数, 0 失败 1 成功。"
LOG INFO " 执行结果: ${start_finish}"
sleep 5s
result=`curl -POST http://${LOCAL_HOSTNAME}:${EXECUTOR_PORT}/executor -d action=activate`
LOG INFO " exectue result: ${result}"
[[ "${result}" =~ .*success.* ]] && { break; }
sleep 3s
runtime=$(( $runtime + 1 ))
LOG INFO " 当前运行次数为${runtime} 超过30次将退出"
if [ ${runtime} -gt 30 ]
LOG INFO "It has been run${runtime} and will exit after 10 times"
if [ ${runtime} -gt 10 ]
then
LOG ERROR "update executor status time out."
return 1
fi
done
LOG INFO " 执行节点启动成功,更新数据库状态。"
update_sql="update executors set active=1 where host='${LOCAL_HOSTNAME}'"
mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DATABASE} -e "${update_sql}" --default-character-set=UTF8
ret=$?
[ "$ret" != "0" ] && { LOG ERROR "update executor status failed. "; return 1; }
LOG INFO "update executor success."
LOG INFO "AzkabanExecutorServer started successfully."
}

function preCheck(){
LOG INFO "checking AzkabanExecutorServer status..."
if [ -f $azkaban_dir/currentpid ]
processName=`jps|grep AzkabanExecutorServer`
if [ -n "$processName" ]
then
LOG INFO "AzkabanExecutorServer already started."
return 1
LOG INFO "AzkabanExecutorServer already started."
return 1
else
return 0
fi
}

Expand Down
2 changes: 1 addition & 1 deletion azkaban-web-server/src/bin/internal/internal-start-web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function javaOption(){

function start(){
LOG INFO "starting AzkabanWebServer..."
java $AZKABAN_OPTS $JAVA_LIB_PATH -cp $CLASSPATH azkaban.webapp.AzkabanWebServer -conf $conf $cycle_stop $@ >> $logFile 2>&1 &
java $AZKABAN_OPTS $JAVA_LIB_PATH -cp $CLASSPATH azkaban.webapp.AzkabanWebServer -conf $conf $@ >> $logFile 2>&1 &
echo $! > $azkaban_dir/currentpid
sleep 3s
processName=`jps|grep AzkabanWebServer`
Expand Down
31 changes: 21 additions & 10 deletions azkaban-web-server/src/main/bash/internal/internal-start-web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ logFile=/appcom/logs/azkaban/webServerLog_`date +%F+%T`.out


function preCheck(){
LOG INFO "checking AzkabanWebServer process status..."
if [ -f $azkaban_dir/currentpid ]
LOG INFO "checking AzkabanWebServer status..."
processName=`jps|grep AzkabanWebServer`
if [ -n "$processName" ]
then
LOG INFO "AzkabanWebServer already started."
return 1
LOG INFO "AzkabanWebServer already started."
return 1
else
return 0
fi
}

Expand Down Expand Up @@ -80,26 +83,34 @@ function javaOption(){
AZKABAN_OPTS="-Xmx16G -Xloggc:/appcom/logs/azkaban/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC"
fi
# Set the log4j configuration file
if [ -f $conf/log4j.properties ]; then
AZKABAN_OPTS="$AZKABAN_OPTS -Dlog4j.configuration=file:$conf/log4j.properties -Dlog4j.log.dir=/appcom/logs/azkaban"
if [ -f $conf/log4j2.xml ]; then
AZKABAN_OPTS="$AZKABAN_OPTS -Dlog4j.configurationFile=$conf/log4j2.xml"
else
LOG ERROR "$conf/log4j.properties file doesn't exist."
return 1
fi

executorport=`cat $conf/azkaban.properties | grep executor.port | awk -F '=' '{print($NF)}'`

AZKABAN_OPTS="$AZKABAN_OPTS -server -Dcom.sun.management.jmxremote -Djava.io.tmpdir=$tmpdir -Dexecutorport=$executorport -Dserverpath=$azkaban_dir"

#AZKABAN_OPTS="$AZKABAN_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006"

}

function start(){
LOG INFO "starting AzkabanWebServer..."
java $AZKABAN_OPTS $JAVA_LIB_PATH -cp $CLASSPATH azkaban.webapp.AzkabanWebServer -conf $conf $cycle_stop $@ >> $logFile 2>&1 &
java $AZKABAN_OPTS $JAVA_LIB_PATH -cp $CLASSPATH azkaban.webapp.AzkabanWebServer -conf $conf $@ >> $logFile 2>&1 &
echo $! > $azkaban_dir/currentpid
LOG INFO "AzkabanWebServer started successfully."
sleep 3s
processName=`jps|grep AzkabanWebServer`
if [ ! -n "$processName" ]
then
LOG INFO "AzkabanWebServer startup failed"
return 1
else
return 0
fi
}

function LOG(){
Expand Down
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<velocity.version>1.7</velocity.version>
<velocity.tools.version>2.0</velocity.tools.version>
<grizzly.version>3.0.0</grizzly.version>
<opendjcore.version>3.0.0</opendjcore.version>
<opendjcore.version>4.4.7</opendjcore.version>
<log4j-api.version>2.13.3</log4j-api.version>
<poi.version>4.1.2</poi.version>
<c3p0.version>0.9.5.5</c3p0.version>
Expand Down Expand Up @@ -144,7 +144,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.forgerock.opendj</groupId>
<groupId>org.openidentityplatform.opendj</groupId>
<artifactId>opendj-core</artifactId>
<version>${opendjcore.version}</version>
</dependency>
Expand Down Expand Up @@ -223,6 +223,13 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down

0 comments on commit ea19721

Please sign in to comment.