fix bug where IOTDB_HOME is misused (#184)

This commit is contained in:
RUI, LEI 2019-05-27 16:06:20 +08:00 committed by XuYi
parent 2fbd949b08
commit 000891f128
10 changed files with 108 additions and 36 deletions

View File

@ -99,6 +99,15 @@ Let $IOTDB_HOME = /workspace/incubator-iotdb/iotdb/iotdb/
Let $IOTDB_CLI_HOME = /workspace/incubator-iotdb/iotdb-cli/cli
Note:
* if `IOTDB_HOME` is not explicitly assigned,
then by default `IOTDB_HOME` is the direct parent directory of `bin/start-server.sh` on Unix/OS X
(or that of `bin\start-server.bat` on Windows).
* if `IOTDB_CLI_HOME` is not explicitly assigned,
then by default `IOTDB_CLI_HOME` is the direct parent directory of `bin/start-client.sh` on
Unix/OS X (or that of `bin\start-client.bat` on Windows).
If you are not the first time that building IoTDB, remember deleting the following files:
```

View File

@ -89,6 +89,16 @@ incubator-iotdb/ <-- root path
Let $IOTDB_HOME = /workspace/incubator-iotdb/iotdb/iotdb/
Let $IOTDB_CLI_HOME = /workspace/incubator-iotdb/iotdb-cli/cli/
Note:
* if `IOTDB_HOME` is not explicitly assigned,
then by default `IOTDB_HOME` is the direct parent directory of `bin/start-server.sh` on Unix/OS X
(or that of `bin\start-server.bat` on Windows).
* if `IOTDB_CLI_HOME` is not explicitly assigned,
then by default `IOTDB_CLI_HOME` is the direct parent directory of `bin/start-client.sh` on
Unix/OS X (or that of `bin\start-client.bat` on Windows).
If you are not the first time that building IoTDB, remember deleting the following files:
```

View File

@ -107,44 +107,95 @@ iotdb/ <-- root path
Use git to get IoTDB source code:
```
Shell > git clone https://github.com/thulab/iotdb.git
Shell > git clone https://github.com/apache/incubator-iotdb.git
```
Or:
```
Shell > git clone git@github.com:apache/incubator-iotdb.git
```
Now suppose your directory is like this:
```
> pwd
/workspace/incubator-iotdb
> ls -l
incubator-iotdb/ <-- root path
|
+- iotdb/
|
+- jdbc/
|
+- iotdb-cli/
|
...
|
+- pom.xml
```
Let $IOTDB_HOME = /workspace/incubator-iotdb/iotdb/iotdb/
Let $IOTDB_CLI_HOME = /workspace/incubator-iotdb/iotdb-cli/cli/
Note:
* if `IOTDB_HOME` is not explicitly assigned,
then by default `IOTDB_HOME` is the direct parent directory of `bin/start-server.sh` on Unix/OS X
(or that of `bin\start-server.bat` on Windows).
* if `IOTDB_CLI_HOME` is not explicitly assigned,
then by default `IOTDB_CLI_HOME` is the direct parent directory of `bin/start-client.sh` on
Unix/OS X (or that of `bin\start-client.bat` on Windows).
If you are not the first time that building IoTDB, remember deleting the following files:
```
rm -rf iotdb/data/
rm -rf iotdb/lib/
> rm -rf $IOTDB_HOME/data/
> rm -rf $IOTDB_HOME/lib/
```
Then under the IoTDB path, you can build IoTDB using Maven:
Then under the root path of incubator-iotdb, you can build IoTDB using Maven:
```
mvn clean package -Dmaven.test.skip=true
> pwd
/workspace/incubator-iotdb
> mvn clean package -pl iotdb -am -Dmaven.test.skip=true
```
If successful, you will see the the following text in the terminal:
```
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] IoTDB Root ......................................... SUCCESS [ 7.020 s]
[INFO] TsFile ............................................. SUCCESS [ 10.486 s]
[INFO] Service-rpc ........................................ SUCCESS [ 3.717 s]
[INFO] IoTDB Jdbc ......................................... SUCCESS [ 3.076 s]
[INFO] IoTDB .............................................. SUCCESS [ 8.258 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
```
Otherwise, you may need to check the error statements and fix the problems.
After build, the IoTDB project will be at the subfolder named iotdb. The folder will include the following contents:
After building, the IoTDB project will be at the subfolder named iotdb. The folder will include the following contents:
```
iotdb/ <-- root path
$IOTDB_HOME/
|
+- bin/ <-- script files
|
+- conf/ <-- configuration files
|
+- lib/ <-- project dependencies
|
+- LICENSE <-- LICENSE
```
<!-- > NOTE: We also provide already built JARs and project at [http://tsfile.org/download](http://tsfile.org/download) instead of build the jar package yourself. -->
### Installation by Docker (Dockerfile)
You can build and run a IoTDB docker image by following the guide of [Deployment by Docker](#build-and-use-iotdb-by-dockerfile)

View File

@ -25,7 +25,7 @@ echo ````````````````````````````````````````````````
if "%OS%" == "Windows_NT" setlocal
pushd %~dp0..
if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%CD%
if NOT DEFINED IOTDB_CLI_HOME set IOTDB_CLI_HOME=%CD%
popd
if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.cli.tool.ExportCsv
@ -34,14 +34,14 @@ if NOT DEFINED JAVA_HOME goto :err
@REM -----------------------------------------------------------------------------
@REM JVM Opts we'll use in legacy run or installation
set JAVA_OPTS=-ea^
-DIOTDB_HOME=%IOTDB_HOME%
-DIOTDB_CLI_HOME=%IOTDB_CLI_HOME%
@REM ***** CLASSPATH library setting *****
@REM Ensure that any user defined CLASSPATH variables are not used on startup
set CLASSPATH=""
REM For each jar in the IOTDB_HOME lib directory call append to build the CLASSPATH variable.
for %%i in ("%IOTDB_HOME%\lib\*.jar") do call :append "%%i"
REM For each jar in the IOTDB_CLI_HOME lib directory call append to build the CLASSPATH variable.
for %%i in ("%IOTDB_CLI_HOME%\lib\*.jar") do call :append "%%i"
goto okClasspath
:append
@ -51,7 +51,7 @@ goto :eof
REM -----------------------------------------------------------------------------
:okClasspath
"%JAVA_HOME%\bin\java" -DIOTDB_HOME=%IOTDB_HOME% %JAVA_OPTS% -cp %CLASSPATH% %MAIN_CLASS% %*
"%JAVA_HOME%\bin\java" -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME% %JAVA_OPTS% -cp %CLASSPATH% %MAIN_CLASS% %*
goto finally

View File

@ -22,8 +22,8 @@ echo ------------------------------------------
echo Starting IoTDB Client Export Script
echo ------------------------------------------
if [ -z "${IOTDB_HOME}" ]; then
export IOTDB_HOME="$(cd "`dirname "$0"`"/..; pwd)"
if [ -z "${IOTDB_CLI_HOME}" ]; then
export IOTDB_CLI_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi
if [ -n "$JAVA_HOME" ]; then
@ -43,11 +43,11 @@ if [ -z $JAVA ] ; then
fi
CLASSPATH=""
for f in ${IOTDB_HOME}/lib/*.jar; do
for f in ${IOTDB_CLI_HOME}/lib/*.jar; do
CLASSPATH=${CLASSPATH}":"$f
done
MAIN_CLASS=org.apache.iotdb.cli.tool.ExportCsv
"$JAVA" -DIOTDB_HOME=${IOTDB_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
"$JAVA" -DIOTDB_CLI_HOME=${IOTDB_CLI_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
exit $?

View File

@ -25,7 +25,7 @@ echo ````````````````````````````````````````````````
if "%OS%" == "Windows_NT" setlocal
pushd %~dp0..
if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%CD%
if NOT DEFINED IOTDB_CLI_HOME set IOTDB_CLI_HOME=%CD%
popd
if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.cli.tool.ImportCsv
@ -34,14 +34,14 @@ if NOT DEFINED JAVA_HOME goto :err
@REM -----------------------------------------------------------------------------
@REM JVM Opts we'll use in legacy run or installation
set JAVA_OPTS=-ea^
-DIOTDB_HOME=%IOTDB_HOME%
-DIOTDB_CLI_HOME=%IOTDB_CLI_HOME%
@REM ***** CLASSPATH library setting *****
@REM Ensure that any user defined CLASSPATH variables are not used on startup
set CLASSPATH=""
REM For each jar in the IOTDB_HOME lib directory call append to build the CLASSPATH variable.
for %%i in ("%IOTDB_HOME%\lib\*.jar") do call :append "%%i"
REM For each jar in the IOTDB_CLI_HOME lib directory call append to build the CLASSPATH variable.
for %%i in ("%IOTDB_CLI_HOME%\lib\*.jar") do call :append "%%i"
goto okClasspath
:append
@ -51,7 +51,7 @@ goto :eof
REM -----------------------------------------------------------------------------
:okClasspath
"%JAVA_HOME%\bin\java" -DIOTDB_HOME=%IOTDB_HOME% %JAVA_OPTS% -cp %CLASSPATH% %MAIN_CLASS% %*
"%JAVA_HOME%\bin\java" -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME% %JAVA_OPTS% -cp %CLASSPATH% %MAIN_CLASS% %*
goto finally

View File

@ -22,8 +22,8 @@ echo ------------------------------------------
echo Starting IoTDB Client Import Script
echo ------------------------------------------
if [ -z "${IOTDB_HOME}" ]; then
export IOTDB_HOME="$(cd "`dirname "$0"`"/..; pwd)"
if [ -z "${IOTDB_CLI_HOME}" ]; then
export IOTDB_CLI_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi
if [ -n "$JAVA_HOME" ]; then
@ -43,11 +43,11 @@ if [ -z $JAVA ] ; then
fi
CLASSPATH=""
for f in ${IOTDB_HOME}/lib/*.jar; do
for f in ${IOTDB_CLI_HOME}/lib/*.jar; do
CLASSPATH=${CLASSPATH}":"$f
done
MAIN_CLASS=org.apache.iotdb.cli.tool.ImportCsv
"$JAVA" -DIOTDB_HOME=${IOTDB_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
"$JAVA" -DIOTDB_CLI_HOME=${IOTDB_CLI_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
exit $?

View File

@ -25,7 +25,7 @@ echo ````````````````````````
if "%OS%" == "Windows_NT" setlocal
pushd %~dp0..
if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%CD%
if NOT DEFINED IOTDB_CLI_HOME set IOTDB_CLI_HOME=%CD%
popd
if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.cli.client.Client
@ -34,10 +34,10 @@ if NOT DEFINED JAVA_HOME goto :err
@REM -----------------------------------------------------------------------------
@REM JVM Opts we'll use in legacy run or installation
set JAVA_OPTS=-ea^
-DIOTDB_HOME=%IOTDB_HOME%
-DIOTDB_CLI_HOME=%IOTDB_CLI_HOME%
REM For each jar in the IOTDB_HOME lib directory call append to build the CLASSPATH variable.
for %%i in ("%IOTDB_HOME%\lib\*.jar") do call :append "%%i"
REM For each jar in the IOTDB_CLI_HOME lib directory call append to build the CLASSPATH variable.
for %%i in ("%IOTDB_CLI_HOME%\lib\*.jar") do call :append "%%i"
goto okClasspath
:append

View File

@ -23,8 +23,8 @@ echo ---------------------
echo Starting IoTDB Client
echo ---------------------
if [ -z "${IOTDB_HOME}" ]; then
export IOTDB_HOME="$(cd "`dirname "$0"`"/..; pwd)"
if [ -z "${IOTDB_CLI_HOME}" ]; then
export IOTDB_CLI_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi
@ -32,7 +32,7 @@ MAIN_CLASS=org.apache.iotdb.cli.client.Client
CLASSPATH=""
for f in ${IOTDB_HOME}/lib/*.jar; do
for f in ${IOTDB_CLI_HOME}/lib/*.jar; do
CLASSPATH=${CLASSPATH}":"$f
done

View File

@ -73,6 +73,8 @@ public class ImportCsv extends AbstractCsvTool {
private static String errorInsertInfo = "";
private static boolean errorFlag;
private static String IOTDB_CLI_HOME = "IOTDB_CLI_HOME";
private static int count;
private static Statement statement;
@ -437,7 +439,7 @@ public class ImportCsv extends AbstractCsvTool {
public static void importCsvFromFile(String ip, String port, String username,
String password, String filename,
String timeZone) throws SQLException {
String property = System.getProperty("IOTDB_HOME");
String property = System.getProperty(IOTDB_CLI_HOME);
if (property == null) {
errorInsertInfo = ERROR_INFO_STR;
} else {