Skip to content

Commit

Permalink
Merge pull request #58 from chaogefeng/master
Browse files Browse the repository at this point in the history
Added JDBC engine support and updated JDBC installation scripts
  • Loading branch information
wushengyeyouya authored Sep 24, 2019
2 parents da80360 + ee655e8 commit 9027cca
Show file tree
Hide file tree
Showing 23 changed files with 1,710 additions and 1 deletion.
19 changes: 18 additions & 1 deletion bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,21 @@ ssh $SERVER_IP "sed -i \"s#wds.linkis.entrance.config.logPath.*#wds.linkis.entr
ssh $SERVER_IP "sed -i \"s#wds.linkis.resultSet.store.path.*#wds.linkis.resultSet.store.path=$HDFS_USER_ROOT_PATH#g\" $SERVER_CONF_PATH"
isSuccess "subsitution linkis.properties of $SERVERNAME"
echo "<----------------$SERVERNAME:end------------------->"
##SparkEntrance install end
##SparkEntrance install end


##JDBCEntrance install
PACKAGE_DIR=linkis/ujes/jdbc
SERVERNAME=linkis-ujes-jdbc-entrance
SERVER_PORT=$JDBC_ENTRANCE_PORT
###install dir
installPackage
###update linkis.properties
echo "$SERVERNAME-step4:update linkis conf"
SERVER_CONF_PATH=$SERVER_HOME/$SERVERNAME/conf/linkis.properties
ssh $SERVER_IP "sed -i \"s#wds.linkis.entrance.config.logPath.*#wds.linkis.entrance.config.logPath=$WORKSPACE_USER_ROOT_PATH#g\" $SERVER_CONF_PATH"
ssh $SERVER_IP "sed -i \"s#wds.linkis.resultSet.store.path.*#wds.linkis.resultSet.store.path=$HDFS_USER_ROOT_PATH#g\" $SERVER_CONF_PATH"
ssh $SERVER_IP "cd $SERVER_HOME/$SERVERNAME/lib;" $SERVER_CONF_PATH"
isSuccess "subsitution linkis.properties of $SERVERNAME"
echo "<----------------$SERVERNAME:end------------------->"
##SparkEntrance install end
20 changes: 20 additions & 0 deletions bin/start-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,26 @@ echo "<-------------------------------->"

sleep 3



#JDBCEntrance
echo "<-------------------------------->"
echo "Begin to start JDBC Entrance"
JDBC_ENTRANCE_NAME="ujes-jdbc-entrance"
JDBC_ENTRANCE_BIN=${LINKIS_INSTALL_HOME}/${APP_PREFIX}${JDBC_ENTRANCE_NAME}/bin
JDBC_ENTRANCE_START_CMD="if [ -d ${JDBC_ENTRANCE_BIN} ];then cd ${JDBC_ENTRANCE_BIN}; dos2unix ./* > /dev/null 2>&1; dos2unix ../conf/* > /dev/null 2>&1; sh start-jdbcentrance.sh > /dev/null;else echo 'WARNING:JDBC Entrance will not start';fi"
if [ -n "${JDBC_INSTALL_IP}" ];then
ssh ${JDBC_INSTALL_IP} "${JDBC_ENTRANCE_START_CMD}"
else
ssh ${local_host} "${JDBC_ENTRANCE_START_CMD}"
fi
echo "End to start JDBC Entrance"
echo "<-------------------------------->"

sleep 3



##PipelineEntrance
#echo "Pipeline Entrance is Starting"
#PIPELINE_ENTRANCE_NAME="ujes-pipeline-entrance"
Expand Down
17 changes: 17 additions & 0 deletions bin/stop-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ echo "<-------------------------------->"



#JDBCEntrance
echo "<-------------------------------->"
echo "Begin to stop JDBC Entrance"
JDBC_ENTRANCE_NAME="ujes-jdbc-entrance"
JDBC_ENTRANCE_BIN=${LINKIS_INSTALL_HOME}/${APP_PREFIX}${JDBC_ENTRANCE_NAME}/bin
JDBC_ENTRANCE_STOP_CMD="if [ -d ${JDBC_ENTRANCE_BIN} ];then cd ${JDBC_ENTRANCE_BIN}; dos2unix ./* > /dev/null 2>&1; dos2unix ../conf/* > /dev/null 2>&1; sh stop-jdbcentrance.sh > /dev/null;else echo 'WARNING:JDBC Entrance will not start';fi"
if [ -n "${JDBC_INSTALL_IP}" ];then
ssh ${JDBC_INSTALL_IP} "${JDBC_ENTRANCE_STOP_CMD}"
else
ssh ${local_host} "${JDBC_ENTRANCE_STOP_CMD}"
fi
echo "End to stop JDBC Entrance"
echo "<-------------------------------->"

sleep 3


##PipelineEntrance
#echo "Pipeline Entrance is Stoping"
#PIPELINE_ENTRANCE_NAME="ujes-pipeline-entrance"
Expand Down
6 changes: 6 additions & 0 deletions conf/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ PYTHON_EM_PORT=12001
PYTHON_ENTRANCE_PORT=12002


### JDBC
### This service is used to provide jdbc capability.
JDBC_INSTALL_IP=127.0.0.1
JDBC_ENTRANCE_PORT=9888



########################################################################################

Expand Down
31 changes: 31 additions & 0 deletions ujes/definedEngines/jdbc/entrance/bin/start-jdbcentrance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

cd `dirname $0`
cd ..
HOME=`pwd`
export DWS_ENGINE_MANAGER_HOME=$HOME

export DWS_ENGINE_MANAGER_PID=$HOME/bin/linkis.pid

if [[ -f "${DWS_ENGINE_MANAGER_PID}" ]]; then
pid=$(cat ${DWS_ENGINE_MANAGER_PID})
if kill -0 ${pid} >/dev/null 2>&1; then
echo "JDBC Entrance is already running."
return 0;
fi
fi

export DWS_ENGINE_MANAGER_LOG_PATH=$HOME/logs
export DWS_ENGINE_MANAGER_HEAP_SIZE="1G"
export DWS_ENGINE_MANAGER_JAVA_OPTS="-Xms$DWS_ENGINE_MANAGER_HEAP_SIZE -Xmx$DWS_ENGINE_MANAGER_HEAP_SIZE -XX:+UseG1GC -XX:MaxPermSize=500m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=11716"

nohup java $DWS_ENGINE_MANAGER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* com.webank.wedatasphere.linkis.DataWorkCloudApplication 2>&1 > $DWS_ENGINE_MANAGER_LOG_PATH/linkis.out &
pid=$!
if [[ -z "${pid}" ]]; then
echo "JDBC Entrance start failed!"
exit 1
else
echo "JDBC Entrance start succeeded!"
echo $pid > $DWS_ENGINE_MANAGER_PID
sleep 1
fi
47 changes: 47 additions & 0 deletions ujes/definedEngines/jdbc/entrance/bin/stop-jdbcentrance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

cd `dirname $0`
cd ..
HOME=`pwd`

export DWS_ENGINE_MANAGER_PID=$HOME/bin/linkis.pid

function wait_for_DWS_ENGINE_MANAGER_to_die() {
local pid
local count
pid=$1
timeout=$2
count=0
timeoutTime=$(date "+%s")
let "timeoutTime+=$timeout"
currentTime=$(date "+%s")
forceKill=1

while [[ $currentTime -lt $timeoutTime ]]; do
$(kill ${pid} > /dev/null 2> /dev/null)
if kill -0 ${pid} > /dev/null 2>&1; then
sleep 3
else
forceKill=0
break
fi
currentTime=$(date "+%s")
done

if [[ forceKill -ne 0 ]]; then
$(kill -9 ${pid} > /dev/null 2> /dev/null)
fi
}

if [[ ! -f "${DWS_ENGINE_MANAGER_PID}" ]]; then
echo "JDBC Entrance is not running"
else
pid=$(cat ${DWS_ENGINE_MANAGER_PID})
if [[ -z "${pid}" ]]; then
echo "JDBC Entrance is not running"
else
wait_for_DWS_ENGINE_MANAGER_to_die $pid 40
$(rm -f ${DWS_ENGINE_MANAGER_PID})
echo "JDBC Entrance is stopped."
fi
fi
136 changes: 136 additions & 0 deletions ujes/definedEngines/jdbc/entrance/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019 WeBank
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<artifactId>linkis</artifactId>
<groupId>com.webank.wedatasphere.linkis</groupId>
<version>0.9.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>linkis-jdbc-entrance</artifactId>


<dependencies>
<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-ujes-entrance</artifactId>
<version>${linkis.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.6</version>
</dependency>
<!-- <dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.1.0.6.0</version>
<scope>runtime</scope>
</dependency>-->
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>1.2.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.hive</groupId>
<artifactId>hive-shims</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
</exclusion>
</exclusions>
</dependency>


<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.2</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>

<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<inherited>false</inherited>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
<configuration>
<skipAssembly>false</skipAssembly>
<finalName>linkis-ujes-jdbc-entrance</finalName>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
<descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.yml</include>
</includes>
</resource>
</resources>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>

</project>
Loading

0 comments on commit 9027cca

Please sign in to comment.