prepare to merge origin

This commit is contained in:
qiaojialingithub 2017-05-15 08:45:47 +08:00
parent efeee4d97c
commit 250ed54fc6
10 changed files with 383 additions and 1 deletions

40
package.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
mvn clean package -DskipTests
if [ -d "./tsfiledb/lib/" ]; then
rm -r ./tsfiledb/lib/
fi
if [ -d "./tsfiledb/doc/" ]; then
rm -r ./tsfiledb/doc/
fi
if [ -d "./tsfiledb/tmp/" ]; then
rm -r ./tsfiledb/tmp/
fi
if [ -d "./tsfiledb/logs/" ]; then
rm -r ./tsfiledb/logs/
fi
if [ -f "./tsfiledb/conf/tsfile.yaml" ]; then
rm ./tsfiledb/conf/tsfile.yaml
fi
if [ -f "./tsfiledb.tar.gz" ]; then
rm ./tsfiledb.tar.gz
fi
mkdir ./tsfiledb/lib/
mkdir ./tsfiledb/doc/
mkdir ./tsfiledb/tmp/
mkdir ./tsfiledb/logs/
#cp ./tsfile-service/target/lib/* ./delta/lib/
#cp ./tsfile-service/target/tsfile-service-0.0.1-SNAPSHOT.jar ./delta/lib/
#cp ./tsfile-jdbc/target/lib/* ./delta/lib/
#cp ./tsfile-jdbc/target/tsfile-jdbc-0.0.1-SNAPSHOT.jar ./delta/lib/
#cp ./tsfile-common/src/main/resources/tsfile.yaml ./delta/conf/
tar -zcf ./tsfiledb.tar.gz ./tsfiledb/

46
pom.xml
View File

@ -91,7 +91,51 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/tsfiledb/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>copy-native-libraries</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy todir="${project.basedir}/tsfiledb/lib">
<fileset dir="${project.basedir}/target/">
<include name="*.jar" />
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- <plugin> <!-- <plugin>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId> <artifactId>antlr4-maven-plugin</artifactId>

7
tsfiledb/Readme.md Normal file
View File

@ -0,0 +1,7 @@
使用方法:
在conf/tsfile-env.sh中设置JAVA_HOME
启动服务器运行bin下面的start-server.sh
启动客户端运行bin下面的start-client.sh -host127.0.0.1 -port6667 -uroot

35
tsfiledb/bin/start-client.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
if [ $# -lt 3 ] ; then
echo "Arguments : -host<host> -port<port> -u<username>"
exit 0
fi
if [ -z "${TSFILE_HOME}" ]; then
export TSFILE_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi
MAIN_CLASS=cn.edu.thu.tsfiledb.jdbc.Client
CLASSPATH=""
for f in ${TSFILE_HOME}/lib/*.jar; do
CLASSPATH=${CLASSPATH}":"$f
done
if [ -n "$JAVA_HOME" ]; then
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
if [ -x "$java" ]; then
JAVA="$java"
break
fi
done
else
JAVA=java
fi
exec "$JAVA" -cp "$CLASSPATH" "$MAIN_CLASS" "$1" "$2" "$3"
exit $?

7
tsfiledb/bin/start-server.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ -z "${TSFILE_HOME}" ]; then
export TSFILE_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi
"$TSFILE_HOME"/bin/tsfiledb-deamon.sh start

7
tsfiledb/bin/stop-server.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ -z "${TSFILE_HOME}" ]; then
export TSFILE_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi
"$TSFILE_HOME"/bin/tsfiledb-deamon.sh stop

89
tsfiledb/bin/tsfiledb-deamon.sh Executable file
View File

@ -0,0 +1,89 @@
#!/bin/sh
if [ -z "${TSFILE_HOME}" ]; then
export TSFILE_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi
TSFILE_CONF=${TSFILE_HOME}/conf
TSFILE_LOGS=${TSFILE_HOME}/logs
if [ -f "$TSFILE_CONF/tsfile-env.sh" ]; then
. "$TSFILE_CONF/tsfile-env.sh"
else
echo "can't find $TSFILE_CONF/tsfile-env.sh"
fi
if [ -n "$JAVA_HOME" ]; then
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
if [ -x "$java" ]; then
JAVA="$java"
break
fi
done
else
JAVA=java
fi
if [ -z $JAVA ] ; then
echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. > /dev/stderr
exit 1;
fi
CLASSPATH=""
for f in ${TSFILE_HOME}/lib/*.jar; do
CLASSPATH=${CLASSPATH}":"$f
done
MAIN_CLASS=cn.edu.thu.tsfiledb.service.JMXManager
pid="$TSFILE_HOME"/tmp/tsfiledb.pid
case "$1" in
start)
if [ -f ${pid} ]; then
TARGET_ID="$(cat "$pid")"
PIDS=`ps -ef |grep "$TARGET_ID" |grep -v grep | awk '{print $2}'`
if [ "$PIDS" != "" ]; then
echo "delta is already running as process "$TARGET_ID". Stop it first."
else
echo "starting delta"
rm -rf ${pid}
"$JAVA" -DTSFILE_HOME=${TSFILE_HOME} -Dlogback.configurationFile=${TSFILE_CONF}/logback.xml -cp "$CLASSPATH" "$MAIN_CLASS"
echo $! > ${pid}
fi
else
echo "starting delta"
rm -rf ${pid}
"$JAVA" -DTSFILE_HOME=${TSFILE_HOME} -Dlogback.configurationFile=${TSFILE_CONF}/logback.xml -cp "$CLASSPATH" "$MAIN_CLASS"
echo $! > ${pid}
fi
;;
stop)
if [ -f ${pid} ]; then
TARGET_ID="$(cat "$pid")"
PIDS=`ps -ef |grep "$TARGET_ID" |grep -v grep | awk '{print $2}'`
if [ "$PIDS" != "" ]; then
echo "stopping delta"
kill `cat $pid`
rm -rf ${pid}
else
echo "no delta to stop"
rm -rf ${pid}
fi
else
echo "no delta to stop"
fi
;;
*)
echo "Usage: run.sh {start|stop}"
;;
esac
exit 0

149
tsfiledb/conf/logback.xml Normal file
View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
说明:
1、日志级别及文件
日志记录采用分级记录,级别与日志文件名相对应,不同级别的日志信息记录到不同的日志文件中
例如error级别记录到log_error_xxx.log或log_error.log该文件为当前记录的日志文件而log_error_xxx.log为归档日志
日志文件按日期记录同一天内若日志文件大小等于或大于2M则按0、1、2...顺序分别命名
例如log-level-2013-12-21.0.log
其它级别的日志也是如此。
2、文件路径
若开发、测试用在Eclipse中运行项目则到Eclipse的安装路径查找logs文件夹以相对路径../logs。
若部署到Tomcat下则在Tomcat下的logs文件中
3、Appender
FILEERROR对应error级别文件名以log-error-xxx.log形式命名
FILEWARN对应warn级别文件名以log-warn-xxx.log形式命名
FILEINFO对应info级别文件名以log-info-xxx.log形式命名
FILEDEBUG对应debug级别文件名以log-debug-xxx.log形式命名
stdout将日志信息输出到控制上为方便开发测试使用
-->
<configuration>
<!-- 日志记录器,日期滚动记录 -->
<appender name="FILEERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${TSFILE_HOME}/logs/log_error.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 归档的日志文件的路径例如今天是2013-12-21日志当前写的日志文件路径为file节点指定可以将此文件与file指定文件路径设置为不同路径从而将当前日志文件或归档日志文件置不同的目录。
而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${TSFILE_HOME}/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- 除按日志记录之外还配置了日志文件不能超过2M若超过2M日志文件会以索引0开始
命名日志文件例如log-error-2013-12-21.0.log -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%-5p [%d] %C:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录error级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="FILEWARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${TSFILE_HOME}/logs/log_warn.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${TSFILE_HOME}/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%-5p [%d] %C:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录warn级别不记录大于warn级别的日志 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>WARN</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="FILEINFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${TSFILE_HOME}/logs/log_info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${TSFILE_HOME}/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>200MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%-5p [%d] [%t] %C:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录info级别不记录大于info级别的日志 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="FILEDEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${TSFILE_HOME}/logs/log_debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${TSFILE_HOME}/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>200MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%-5p [%d] [%t] %C:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录debug级别不记录大于debug级别的日志 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<Target>System.out</Target>
<encoder>
<pattern>%-5p [%d] [%thread] %C:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志appender是为开发使用只配置最底级别控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- <filter class="ch.qos.logback.classic.filter.LevelFilter"> -->
<!-- <level>DEBUG</level> -->
<!-- <onMatch>ACCEPT</onMatch> -->
<!-- <onMismatch>DENY</onMismatch> -->
<!-- </filter> -->
</appender>
<!-- <logger name="com.corp.tsfile.bufferwrite" level="debug"/> -->
<!-- 为单独的包配置日志级别若root的级别大于此级别 此处级别也会输出
应用场景生产环境一般不会将日志级别设置为trace或debug但是为详细的记录SQL语句的情况
可将hibernate的级别设置为debug如此一来日志文件中就会出现hibernate的debug级别日志
而其它包则会按root的级别输出日志
-->
<!-- 生产环境,将此级别配置为适合的级别,以名日志文件太多或影响程序性能 -->
<root level="ERROR">
<appender-ref ref="FILEDEBUG" />
<appender-ref ref="FILEINFO" />
<appender-ref ref="FILEWARN" />
<appender-ref ref="FILEERROR" />
<!-- 生产环境将请stdout去掉 -->
<appender-ref ref="stdout" />
</root>
</configuration>

3
tsfiledb/conf/tsfile-env.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home

View File

@ -0,0 +1 @@