This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch rel/1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.0 by this push:
     new 08b36eb2f2 [To rel/1.0][IOTDB-5258] merge tsfile md and add export 
tsfile and csv tool add timeout param (#8554)
08b36eb2f2 is described below

commit 08b36eb2f2a7db1f3a957781b53d84105ba06209
Author: Zhijia Cao <[email protected]>
AuthorDate: Wed Dec 21 16:52:55 2022 +0800

    [To rel/1.0][IOTDB-5258] merge tsfile md and add export tsfile and csv tool 
add timeout param (#8554)
---
 .../org/apache/iotdb/tool/AbstractCsvTool.java     |   3 +
 .../org/apache/iotdb/tool/AbstractTsFileTool.java  |   2 +
 .../main/java/org/apache/iotdb/tool/ExportCsv.java |  16 +++-
 .../java/org/apache/iotdb/tool/ExportTsFile.java   |  18 +++-
 docs/UserGuide/Maintenance-Tools/CSV-Tool.md       |   6 ++
 .../Maintenance-Tools/TsFile-Load-Export-Tool.md   | 100 ++++++++++++++++++++-
 docs/zh/UserGuide/Maintenance-Tools/CSV-Tool.md    |   6 ++
 .../Maintenance-Tools/TsFile-Load-Export-Tool.md   |  98 +++++++++++++++++++-
 site/src/main/.vuepress/config.js                  |  12 +--
 9 files changed, 245 insertions(+), 16 deletions(-)

diff --git a/cli/src/main/java/org/apache/iotdb/tool/AbstractCsvTool.java 
b/cli/src/main/java/org/apache/iotdb/tool/AbstractCsvTool.java
index 0d3ef345ef..bcebf62cad 100644
--- a/cli/src/main/java/org/apache/iotdb/tool/AbstractCsvTool.java
+++ b/cli/src/main/java/org/apache/iotdb/tool/AbstractCsvTool.java
@@ -56,6 +56,9 @@ public abstract class AbstractCsvTool {
 
   protected static final String TIME_ZONE_ARGS = "tz";
   protected static final String TIME_ZONE_NAME = "timeZone";
+
+  protected static final String TIMEOUT_ARGS = "t";
+  protected static final String TIMEOUT_NAME = "timeout";
   protected static final int MAX_HELP_CONSOLE_WIDTH = 92;
   protected static final String[] TIME_FORMAT =
       new String[] {"default", "long", "number", "timestamp"};
diff --git a/cli/src/main/java/org/apache/iotdb/tool/AbstractTsFileTool.java 
b/cli/src/main/java/org/apache/iotdb/tool/AbstractTsFileTool.java
index c42068571e..3f36bd028b 100644
--- a/cli/src/main/java/org/apache/iotdb/tool/AbstractTsFileTool.java
+++ b/cli/src/main/java/org/apache/iotdb/tool/AbstractTsFileTool.java
@@ -43,6 +43,8 @@ public abstract class AbstractTsFileTool {
   protected static final String USERNAME_ARGS = "u";
   protected static final String USERNAME_NAME = "username";
 
+  protected static final String TIMEOUT_ARGS = "t";
+  protected static final String TIMEOUT_NAME = "timeout";
   protected static final int MAX_HELP_CONSOLE_WIDTH = 92;
   protected static final int CODE_OK = 0;
   protected static final int CODE_ERROR = 1;
diff --git a/cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java 
b/cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java
index 3a18261cb1..a63595d25a 100644
--- a/cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java
+++ b/cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java
@@ -91,6 +91,8 @@ public class ExportCsv extends AbstractCsvTool {
 
   private static final int EXPORT_PER_LINE_COUNT = 10000;
 
+  private static long timeout = -1;
+
   /** main function of export csv tool. */
   public static void main(String[] args) {
     Options options = createOptions();
@@ -180,7 +182,10 @@ public class ExportCsv extends AbstractCsvTool {
     targetFile = commandLine.getOptionValue(TARGET_FILE_ARGS);
     needDataTypePrinted = 
Boolean.valueOf(commandLine.getOptionValue(DATA_TYPE_ARGS));
     queryCommand = commandLine.getOptionValue(QUERY_COMMAND_ARGS);
-
+    String timeoutString = commandLine.getOptionValue(TIMEOUT_ARGS);
+    if (timeoutString != null) {
+      timeout = Long.parseLong(timeoutString);
+    }
     if (needDataTypePrinted == null) {
       needDataTypePrinted = true;
     }
@@ -287,6 +292,13 @@ public class ExportCsv extends AbstractCsvTool {
             .build();
     options.addOption(opHelp);
 
+    Option opTimeout =
+        Option.builder(TIMEOUT_ARGS)
+            .longOpt(TIMEOUT_NAME)
+            .hasArg()
+            .desc("Timeout for session query")
+            .build();
+    options.addOption(opTimeout);
     return options;
   }
 
@@ -316,7 +328,7 @@ public class ExportCsv extends AbstractCsvTool {
   private static void dumpResult(String sql, int index) {
     final String path = targetDirectory + targetFile + index;
     try {
-      SessionDataSet sessionDataSet = session.executeQueryStatement(sql);
+      SessionDataSet sessionDataSet = session.executeQueryStatement(sql, 
timeout);
       List<Object> headers = new ArrayList<>();
       List<String> names = sessionDataSet.getColumnNames();
       List<String> types = sessionDataSet.getColumnTypes();
diff --git a/cli/src/main/java/org/apache/iotdb/tool/ExportTsFile.java 
b/cli/src/main/java/org/apache/iotdb/tool/ExportTsFile.java
index 4a95947a16..3bad8f1982 100644
--- a/cli/src/main/java/org/apache/iotdb/tool/ExportTsFile.java
+++ b/cli/src/main/java/org/apache/iotdb/tool/ExportTsFile.java
@@ -71,6 +71,8 @@ public class ExportTsFile extends AbstractTsFileTool {
   private static String targetFile = DUMP_FILE_NAME_DEFAULT;
   private static String queryCommand;
 
+  private static long timeout = -1;
+
   /** main function of export tsFile tool. */
   public static void main(String[] args) {
     Options options = createOptions();
@@ -172,7 +174,10 @@ public class ExportTsFile extends AbstractTsFileTool {
     targetDirectory = checkRequiredArg(TARGET_DIR_ARGS, TARGET_DIR_NAME, 
commandLine);
     queryCommand = commandLine.getOptionValue(QUERY_COMMAND_ARGS);
     targetFile = commandLine.getOptionValue(TARGET_FILE_ARGS);
-
+    String timeoutString = commandLine.getOptionValue(TIMEOUT_ARGS);
+    if (timeoutString != null) {
+      timeout = Long.parseLong(timeoutString);
+    }
     if (targetFile == null) {
       targetFile = DUMP_FILE_NAME_DEFAULT;
     }
@@ -231,6 +236,13 @@ public class ExportTsFile extends AbstractTsFileTool {
             .build();
     options.addOption(opHelp);
 
+    Option opTimeout =
+        Option.builder(TIMEOUT_ARGS)
+            .longOpt(TIMEOUT_NAME)
+            .hasArg()
+            .desc("Timeout for session query")
+            .build();
+    options.addOption(opTimeout);
     return options;
   }
 
@@ -259,7 +271,7 @@ public class ExportTsFile extends AbstractTsFileTool {
   private static void dumpResult(String sql, int index) {
     final String path = targetDirectory + targetFile + index + ".tsfile";
     try {
-      SessionDataSet sessionDataSet = session.executeQueryStatement(sql, 
10000);
+      SessionDataSet sessionDataSet = session.executeQueryStatement(sql, 
timeout);
       long start = System.currentTimeMillis();
       writeTsFileFile(sessionDataSet, path);
       long end = System.currentTimeMillis();
@@ -294,7 +306,7 @@ public class ExportTsFile extends AbstractTsFileTool {
         Path path = new Path(column, true);
         String deviceId = path.getDevice();
         List<Field> deviceList =
-            session.executeQueryStatement("show devices " + deviceId, 
10000).next().getFields();
+            session.executeQueryStatement("show devices " + deviceId, 
timeout).next().getFields();
         if (deviceList.size() > 1 && 
"true".equals(deviceList.get(1).getStringValue())) {
           deviceFilterSet.add(deviceId);
         }
diff --git a/docs/UserGuide/Maintenance-Tools/CSV-Tool.md 
b/docs/UserGuide/Maintenance-Tools/CSV-Tool.md
index 556bf6c48a..2acb5ff9b0 100644
--- a/docs/UserGuide/Maintenance-Tools/CSV-Tool.md
+++ b/docs/UserGuide/Maintenance-Tools/CSV-Tool.md
@@ -53,6 +53,8 @@ Description:
 * `-linesPerFile <int>`:
   - Specifying lines of each dump file, `10000` is default.
   - example: `-linesPerFile 1`
+* `-t <timeout>`:
+  - Specifies the timeout period for session queries, in milliseconds
 
 
 More, if you don't use one of `-s` and `-q`, you need to enter some queries 
after running the export script. The results of the different query will be 
saved to different CSV files.
@@ -72,6 +74,8 @@ More, if you don't use one of `-s` and `-q`, you need to 
enter some queries afte
 > tools/export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
 > yyyy-MM-dd\ HH:mm:ss -s sql.txt
 # Or
 > tools/export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
 > yyyy-MM-dd\ HH:mm:ss -s sql.txt -linesPerFile 10
+# Or
+> tools/export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
yyyy-MM-dd\ HH:mm:ss -s sql.txt -linesPerFile 10 -t 10000
 
 # Windows
 > tools/export-csv.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./
@@ -85,6 +89,8 @@ More, if you don't use one of `-s` and `-q`, you need to 
enter some queries afte
 > tools/export-csv.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
 > yyyy-MM-dd\ HH:mm:ss -s sql.txt
 # Or
 > tools/export-csv.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
 > yyyy-MM-dd\ HH:mm:ss -s sql.txt -linesPerFile 10
+# Or
+> tools/export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
yyyy-MM-dd\ HH:mm:ss -s sql.txt -linesPerFile 10 -t 10000
 ```
 
 ### Sample SQL file
diff --git a/docs/UserGuide/Maintenance-Tools/TsFile-Load-Export-Tool.md 
b/docs/UserGuide/Maintenance-Tools/TsFile-Load-Export-Tool.md
index dd07145856..1e6657c651 100644
--- a/docs/UserGuide/Maintenance-Tools/TsFile-Load-Export-Tool.md
+++ b/docs/UserGuide/Maintenance-Tools/TsFile-Load-Export-Tool.md
@@ -18,12 +18,102 @@
     under the License.
 
 -->
+# TsFile Load And Export Tool
 
-# TsFile Tool
+## TsFile Load Tool
+
+### Introduction
+
+The load external tsfile tool allows users to load tsfiles, delete a tsfile, 
or move a tsfile to target directory from the running Apache IoTDB instance. 
Alternatively, you can use scripts to load tsfiles into IoTDB, for more 
information.
+
+### Load with SQL
+
+The user sends specified commands to the Apache IoTDB system through the Cli 
tool or JDBC to use the tool.
+
+#### load tsfiles
+
+The command to load tsfiles is `load <path/dir> 
[sglevel=int][verify=true/false][onSuccess=delete/none]`.
+
+This command has two usages:
+
+1. Load a single tsfile by specifying a file path (absolute path).
+
+The first parameter indicates the path of the tsfile to be loaded. This 
command has three options: sglevel, verify, onSuccess.
+
+SGLEVEL option. If the database correspond to the tsfile does not exist, the 
user can set the level of database through the fourth parameter. By default, it 
uses the database level which is set in `iotdb-datanode.properties`.
+
+VERIFY option. If this parameter is true, All timeseries in this loading 
tsfile will be compared with the timeseries in IoTDB. If existing a measurement 
which has different datatype with the measurement in IoTDB, the loading process 
will be stopped and exit. If consistence can be promised, setting false for 
this parameter will be a better choice.
+
+ONSUCCESS option. The default value is DELETE, which means  the processing 
method of successfully loaded tsfiles, and DELETE means  after the tsfile is 
successfully loaded, it will be deleted. NONE means after the tsfile is 
successfully loaded, it will be remained in the origin dir.
+
+If the `.resource` file corresponding to the file exists, it will be loaded 
into the data directory and engine of the Apache IoTDB. Otherwise, the 
corresponding `.resource` file will be regenerated from the tsfile file.
+
+Examples:
+
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile'`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=true`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=false`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' sglevel=1`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' onSuccess=delete`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=true sglevel=1`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=false 
sglevel=1`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=true 
onSuccess=none`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=false 
sglevel=1 onSuccess=delete`
+
+2. Load a batch of files by specifying a folder path (absolute path).
+
+The first parameter indicates the path of the tsfile to be loaded. The options 
above also works for this command.
+
+Examples:
+
+* `load '/Users/Desktop/data'`
+* `load '/Users/Desktop/data' verify=false`
+* `load '/Users/Desktop/data' verify=true`
+* `load '/Users/Desktop/data' verify=true sglevel=1`
+* `load '/Users/Desktop/data' verify=false sglevel=1 onSuccess=delete`
+
+**NOTICE**:  When `$IOTDB_HOME$/conf/iotdb-datanode.properties` has 
`enable_auto_create_schema=true`, it will automatically create metadata in 
TSFILE, otherwise it will not be created automatically.
+
+### Load with Script
+
+Run rewrite-tsfile.bat if you are in a Windows environment, or 
rewrite-tsfile.sh if you are on Linux or Unix.
+
+```bash
+./load-tsfile.bat -f filePath [-h host] [-p port] [-u username] [-pw password] 
[--sgLevel int] [--verify true/false] [--onSuccess none/delete]
+-f                     File/Directory to be load, required
+-h                     IoTDB Host address, optional field, 127.0.0.1 by default
+-p                     IoTDB port, optional field, 6667 by default
+-u                     IoTDB user name, optional field, root by default
+-pw            IoTDB password, optional field, root by default
+--sgLevel      Sg level of loading Tsfile, optional field, 
default_storage_group_level in                              
iotdb-common.properties by default
+--verify       Verify schema or not, optional field, True by default
+--onSuccess Delete or remain origin TsFile after loading, optional field, none 
by default
+```
+
+#### Example
+
+Assuming that an IoTDB instance is running on server 192.168.0.101:6667, you 
want to load all TsFile files from the locally saved TsFile backup folder 
D:\IoTDB\data into this IoTDB instance.
+
+First move to the folder `$IOTDB_HOME/tools/`, open the command line, and 
execute
+
+```bash
+./load-rewrite.bat -f D:\IoTDB\data -h 192.168.0.101 -p 6667 -u root -pw root
+```
+
+After waiting for the script execution to complete, you can check that the 
data in the IoTDB instance has been loaded correctly.
+
+#### Q&A
+
+- Cannot find or load the main class
+  - It may be because the environment variable $IOTDB_HOME is not set, please 
set the environment variable and try again
+- -f option must be set!
+  - The input command is missing the -f field (file or folder path to be 
loaded) or the -u field (user name), please add it and re-execute
+- What if the execution crashes in the middle and you want to reload?
+  - You re-execute the command just now, reloading the data will not affect 
the correctness after loading
 
 TsFile can help you export the result set in the format of TsFile file to the 
specified path by executing the sql, command line sql, and sql file.
 
-## Usage of export-tsfile.sh
+## TsFile Export Tool
 
 ### Syntax
 
@@ -53,6 +143,8 @@ TsFile can help you export the result set in the format of 
TsFile file to the sp
   - Example: `select * from root.** limit 100`
 * `-s <sql file>`:
   - Specify a SQL file that contains one or more SQL statements. If an SQL 
file contains multiple SQL statements, the SQL statements should be separated 
by newlines. Each SQL statement corresponds to an output TsFile file.
+* `-t <timeout>`:
+  - Specifies the timeout period for session queries, in milliseconds
 
 
 In addition, if you do not use the `-s` and `-q` parameters, after the export 
script is started, you need to enter the query statement as prompted by the 
program, and different query results will be saved to different TsFile files.
@@ -68,6 +160,8 @@ In addition, if you do not use the `-s` and `-q` parameters, 
after the export sc
 > tools/export-tsfile.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
 > ./sql.txt
 # Or
 > tools/export-tsfile.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
 > ./sql.txt -f myTsFile
+# Or
+> tools/export-tsfile.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
./sql.txt -f myTsFile -t 10000
 
 # Windows
 > tools/export-tsfile.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./
@@ -77,6 +171,8 @@ In addition, if you do not use the `-s` and `-q` parameters, 
after the export sc
 > tools/export-tsfile.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
 > ./sql.txt
 # Or
 > tools/export-tsfile.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
 > ./sql.txt -f myTsFile
+# Or
+> tools/export-tsfile.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
./sql.txt -f myTsFile -t 10000
 ```
 
 ### example
diff --git a/docs/zh/UserGuide/Maintenance-Tools/CSV-Tool.md 
b/docs/zh/UserGuide/Maintenance-Tools/CSV-Tool.md
index d7328871a3..c8f32d3713 100644
--- a/docs/zh/UserGuide/Maintenance-Tools/CSV-Tool.md
+++ b/docs/zh/UserGuide/Maintenance-Tools/CSV-Tool.md
@@ -53,6 +53,8 @@ CSV 工具可帮您将 CSV 格式的数据导入到 IoTDB 或者将数据从 IoT
 * `-linesPerFile <int>`:
   - 指定导出的dump文件最大行数,默认值为`10000`。
   - 例如: `-linesPerFile 1`
+* `-t <timeout>`:
+  - 指定session查询时的超时时间,单位为ms
 
 除此之外,如果你没有使用`-s`和`-q`参数,在导出脚本被启动之后你需要按照程序提示输入查询语句,不同的查询结果会被保存到不同的CSV文件中。
 
@@ -71,6 +73,8 @@ CSV 工具可帮您将 CSV 格式的数据导入到 IoTDB 或者将数据从 IoT
 > tools/export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
 > yyyy-MM-dd\ HH:mm:ss -s sql.txt
 # Or
 > tools/export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
 > yyyy-MM-dd\ HH:mm:ss -s sql.txt -linesPerFile 10
+# Or
+> tools/export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
yyyy-MM-dd\ HH:mm:ss -s sql.txt -linesPerFile 10 -t 10000
 
 # Windows
 > tools/export-csv.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./
@@ -84,6 +88,8 @@ CSV 工具可帮您将 CSV 格式的数据导入到 IoTDB 或者将数据从 IoT
 > tools/export-csv.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
 > yyyy-MM-dd\ HH:mm:ss -s sql.txt
 # Or
 > tools/export-csv.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
 > yyyy-MM-dd\ HH:mm:ss -s sql.txt -linesPerFile 10
+# Or
+> tools/export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -tf 
yyyy-MM-dd\ HH:mm:ss -s sql.txt -linesPerFile 10 -t 10000
 ```
 
 ### SQL 文件示例
diff --git a/docs/zh/UserGuide/Maintenance-Tools/TsFile-Load-Export-Tool.md 
b/docs/zh/UserGuide/Maintenance-Tools/TsFile-Load-Export-Tool.md
index ed464a390c..74b4f2c028 100644
--- a/docs/zh/UserGuide/Maintenance-Tools/TsFile-Load-Export-Tool.md
+++ b/docs/zh/UserGuide/Maintenance-Tools/TsFile-Load-Export-Tool.md
@@ -19,7 +19,97 @@
 
 -->
 
-# 导入导出 TsFile
+# 导入 TsFile
+
+## 介绍
+加载外部 tsfile 文件工具允许用户向正在运行中的 Apache IoTDB 中加载 tsfile 
文件。或者您也可以使用脚本的方式将tsfile加载进IoTDB。
+
+## 使用SQL加载
+用户通过 Cli 工具或 JDBC 向 Apache IoTDB 系统发送指定命令实现文件加载的功能。
+
+### 加载 tsfile 文件
+
+加载 tsfile 文件的指令为:`load '<path/dir>' 
[sglevel=int][verify=true/false][onSuccess=delete/none]`
+
+该指令有两种用法:
+
+1. 通过指定文件路径(绝对路径)加载单 tsfile 文件。
+
+第一个参数表示待加载的 tsfile 文件的路径。load 命令有三个可选项,分别是 sglevel,值域为整数,verify,值域为 
true/false,onSuccess,值域为delete/none。不同选项之间用空格隔开,选项之间无顺序要求。
+
+SGLEVEL 选项,当 tsfile 对应的 database 不存在时,用户可以通过 sglevel 参数的值来制定 database 
的级别,默认为`iotdb-datanode.properties`中设置的级别。例如当设置 level 参数为1时表明此 tsfile 
中所有时间序列中层级为1的前缀路径是 database,即若存在设备 root.sg.d1.s1,此时 root.sg 被指定为 database。
+
+VERIFY 选项表示是否对载入的 tsfile 中的所有时间序列进行元数据检查,默认为 true。开启时,若载入的 tsfile 中的时间序列在当前 
iotdb 中也存在,则会比较该时间序列的所有 Measurement 的数据类型是否一致,如果出现不一致将会导致载入失败,关闭该选项会跳过检查,载入更快。
+
+ONSUCCESS选项表示对于成功载入的tsfile的处置方式,默认为delete,即tsfile成功加载后将被删除,如果是none表明tsfile成功加载之后依然被保留在源文件夹。
+
+若待加载的 tsfile 文件对应的`.resource`文件存在,会被一并加载至 Apache IoTDB 数据文件的目录和引擎中,否则将通过 
tsfile 文件重新生成对应的`.resource`文件,即加载的 tsfile 文件所对应的`.resource`文件不是必要的。
+
+示例:
+
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile'`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=true`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=false`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' sglevel=1`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' onSuccess=delete`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=true sglevel=1`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=false 
sglevel=1`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=true 
onSuccess=none`
+* `load '/Users/Desktop/data/1575028885956-101-0.tsfile' verify=false 
sglevel=1 onSuccess=delete`
+
+
+2. 通过指定文件夹路径(绝对路径)批量加载文件。
+
+第一个参数表示待加载的 tsfile 文件夹的路径。选项意义与加载单个 tsfile 文件相同。
+
+示例:
+
+* `load '/Users/Desktop/data'`
+* `load '/Users/Desktop/data' verify=false`
+* `load '/Users/Desktop/data' verify=true`
+* `load '/Users/Desktop/data' verify=true sglevel=1`
+* `load '/Users/Desktop/data' verify=false sglevel=1 onSuccess=delete`
+
+**注意**,如果`$IOTDB_HOME$/conf/iotdb-datanode.properties`中`enable_auto_create_schema=true`时会在加载tsfile的时候自动创建tsfile中的元数据,否则不会自动创建。
+
+## 使用脚本加载
+
+若您在Windows环境中,请运行`$IOTDB_HOME/tools/load-tsfile.bat`,若为Linux或Unix,请运行`load-tsfile.sh`
+
+```bash
+./load-tsfile.bat -f filePath [-h host] [-p port] [-u username] [-pw password] 
[--sgLevel int] [--verify true/false] [--onSuccess none/delete]
+-f                     待加载的文件或文件夹路径,必要字段
+-h                     IoTDB的Host地址,可选,默认127.0.0.1
+-p                     IoTDB的端口,可选,默认6667
+-u                     IoTDb登录用户名,可选,默认root
+-pw            IoTDB登录密码,可选,默认root
+--sgLevel      加载TsFile自动创建Database的路径层级,可选,默认值为iotdb-common.properties指定值
+--verify       是否对加载TsFile进行元数据校验,可选,默认为True
+--onSuccess 对成功加载的TsFile的处理方法,可选,默认为delete,成功加载之后删除源TsFile,设为none时会            
                保留源TsFile
+```
+
+### 使用范例
+
+假定服务器192.168.0.101:6667上运行一个IoTDB实例,想从将本地保存的TsFile备份文件夹D:\IoTDB\data中的所有的TsFile文件都加载进此IoTDB实例。
+
+首先移动至`$IOTDB_HOME/tools/`,打开命令行,然后执行
+
+```bash
+./load-tsfile.bat -f D:\IoTDB\data -h 192.168.0.101 -p 6667 -u root -pw root
+```
+
+等待脚本执行完成之后,可以检查IoTDB实例中数据已经被正确加载
+
+### 常见问题
+
+- 找不到或无法加载主类
+  - 可能是由于未设置环境变量$IOTDB_HOME,请设置环境变量之后重试
+- 提示-f option must be set!
+  - 输入命令缺少待-f字段(加载文件或文件夹路径),请添加之后重新执行
+- 执行到中途崩溃了想重新加载怎么办
+  - 重新执行刚才的命令,重新加载数据不会影响加载之后的正确性
+
+# 导出 TsFile
 
 TsFile 工具可帮您 通过执行指定sql、命令行sql、sql文件的方式将结果集以TsFile文件的格式导出至指定路径.
 
@@ -54,6 +144,8 @@ TsFile 工具可帮您 通过执行指定sql、命令行sql、sql文件的方式
   - 例如: `select * from root.** limit 100`
 * `-s <sql file>`:
   - 
指定一个SQL文件,里面包含一条或多条SQL语句。如果一个SQL文件中包含多条SQL语句,SQL语句之间应该用换行符进行分割。每一条SQL语句对应一个输出的TsFile文件。
+* `-t <timeout>`:
+  - 指定session查询时的超时时间,单位为ms
 
 
 除此之外,如果你没有使用`-s`和`-q`参数,在导出脚本被启动之后你需要按照程序提示输入查询语句,不同的查询结果会被保存到不同的TsFile文件中。
@@ -69,6 +161,8 @@ TsFile 工具可帮您 通过执行指定sql、命令行sql、sql文件的方式
 > tools/export-tsfile.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
 > ./sql.txt
 # Or
 > tools/export-tsfile.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
 > ./sql.txt -f myTsFile
+# Or
+> tools/export-tsfile.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
./sql.txt -f myTsFile -t 10000
 
 # Windows
 > tools/export-tsfile.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./
@@ -78,6 +172,8 @@ TsFile 工具可帮您 通过执行指定sql、命令行sql、sql文件的方式
 > tools/export-tsfile.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
 > ./sql.txt
 # Or
 > tools/export-tsfile.bat -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
 > ./sql.txt -f myTsFile
+# Or
+> tools/export-tsfile.sh -h 127.0.0.1 -p 6667 -u root -pw root -td ./ -s 
./sql.txt -f myTsFile -t 10000
 ```
 
 ### Q&A
diff --git a/site/src/main/.vuepress/config.js 
b/site/src/main/.vuepress/config.js
index e431a919b2..c2bb69613b 100644
--- a/site/src/main/.vuepress/config.js
+++ b/site/src/main/.vuepress/config.js
@@ -998,12 +998,11 @@ var config = {
                                                        
['Maintenance-Tools/Log-Tool','Log Tool'],
                                                        
['Maintenance-Tools/JMX-Tool','JMX Tool'],
                                                        
['Maintenance-Tools/MLogParser-Tool','MLogParser Tool'],
-                                                       
['Maintenance-Tools/Load-Tsfile','Load TsFile'],
                                                        
['Maintenance-Tools/IoTDB-Data-Dir-Overview-Tool','IoTDB Data Directory 
Overview Tool'],
                                                        
['Maintenance-Tools/TsFile-Sketch-Tool','TsFile Sketch Tool'],
                                                        
['Maintenance-Tools/TsFile-Resource-Sketch-Tool','TsFile Resource Sketch Tool'],
                                                        
['Maintenance-Tools/TsFile-Split-Tool','TsFile Split Tool'],
-                                                       
['Maintenance-Tools/TsFile-Load-Export-Tool','TsFile Export Tool'],
+                                                       
['Maintenance-Tools/TsFile-Load-Export-Tool','TsFile Load Export Tool'],
                                                        
['Maintenance-Tools/CSV-Tool','CSV Load Export Tool'],
                                                ]
                                        },
@@ -1232,12 +1231,11 @@ var config = {
                                                        
['Maintenance-Tools/Log-Tool','Log Tool'],
                                                        
['Maintenance-Tools/JMX-Tool','JMX Tool'],
                                                        
['Maintenance-Tools/MLogParser-Tool','MLogParser Tool'],
-                                                       
['Maintenance-Tools/Load-Tsfile','Load TsFile'],
                                                        
['Maintenance-Tools/IoTDB-Data-Dir-Overview-Tool','IoTDB Data Directory 
Overview Tool'],
                                                        
['Maintenance-Tools/TsFile-Sketch-Tool','TsFile Sketch Tool'],
                                                        
['Maintenance-Tools/TsFile-Resource-Sketch-Tool','TsFile Resource Sketch Tool'],
                                                        
['Maintenance-Tools/TsFile-Split-Tool','TsFile Split Tool'],
-                                                       
['Maintenance-Tools/TsFile-Load-Export-Tool','TsFile Export Tool'],
+                                                       
['Maintenance-Tools/TsFile-Load-Export-Tool','TsFile Load Export Tool'],
                                                        
['Maintenance-Tools/CSV-Tool','CSV Load Export Tool'],
                                                ]
                                        },
@@ -2208,12 +2206,11 @@ var config = {
                                                        
['Maintenance-Tools/Log-Tool','日志工具'],
                                                        
['Maintenance-Tools/JMX-Tool','JMX 工具'],
                                                        
['Maintenance-Tools/MLogParser-Tool','Mlog解析工具'],
-                                                       
['Maintenance-Tools/Load-Tsfile','加载 TsFile'],
                                                        
['Maintenance-Tools/IoTDB-Data-Dir-Overview-Tool','IoTDB数据文件夹概览工具'],
                                                        
['Maintenance-Tools/TsFile-Sketch-Tool','TsFile概览工具'],
                                                        
['Maintenance-Tools/TsFile-Resource-Sketch-Tool','TsFile Resource概览工具'],
                                                        
['Maintenance-Tools/TsFile-Split-Tool','TsFile 拆分工具'],
-                                                       
['Maintenance-Tools/TsFile-Load-Export-Tool','TsFile 导出工具'],
+                                                       
['Maintenance-Tools/TsFile-Load-Export-Tool','TsFile 导入导出工具'],
                                                        
['Maintenance-Tools/CSV-Tool','CSV 导入导出工具'],
                                                ]
                                        },
@@ -2442,12 +2439,11 @@ var config = {
                                                        
['Maintenance-Tools/Log-Tool','日志工具'],
                                                        
['Maintenance-Tools/JMX-Tool','JMX 工具'],
                                                        
['Maintenance-Tools/MLogParser-Tool','Mlog解析工具'],
-                                                       
['Maintenance-Tools/Load-Tsfile','加载 TsFile'],
                                                        
['Maintenance-Tools/IoTDB-Data-Dir-Overview-Tool','IoTDB数据文件夹概览工具'],
               ['Maintenance-Tools/TsFile-Sketch-Tool','TsFile概览工具'],
               ['Maintenance-Tools/TsFile-Resource-Sketch-Tool','TsFile 
Resource概览工具'],
                                                        
['Maintenance-Tools/TsFile-Split-Tool','TsFile 拆分工具'],
-                                                       
['Maintenance-Tools/TsFile-Load-Export-Tool','TsFile 导出工具'],
+                                                       
['Maintenance-Tools/TsFile-Load-Export-Tool','TsFile 导入导出工具'],
                                                        
['Maintenance-Tools/CSV-Tool','CSV 导入导出工具'],
                                                ]
                                        },

Reply via email to