元数据导出

1. 功能概述

元数据导出工具 export-schema.sh/bat 位于tools 目录下,能够将 IoTDB 中指定数据库下的元数据导出为csv文件。

V1.3.3 版本起支持

2. 功能详解

2.1 参数介绍

参数缩写参数全称参数含义是否为必填项默认值
-h-- host主机名否127.0.0.1
-p--port端口号否6667
-u--username用户名否root
-pw--password密码否root
-t--target指定输出文件的目标文件夹,如果路径不存在新建文件夹是
-path--path_pattern指定导出元数据的path pattern是
-pf--path_pattern_file指定导出文件的名称。否
-lpf--lines_per_file指定导出的dump文件最大行数否10000
-timeout--queryTimeout会话查询的超时时间(ms)否-1范围:-1~Long. max=9223372036854775807
-help--help显示帮助信息否

2.2 运行命令

Shell
# Unix/OS X
> tools/export-schema.sh [-h <host>] [-p <port>] [-u <username>] [-pw <password>] -t <targetDir>
       [-path <exportPathPattern>] [-pf <exportPathPatternFile>] [-lpf <linesPerFile>]
       [-timeout <timeout>] [-help]

# Windows
> tools\export-schema.bat [-h <host>] [-p <port>] [-u <username>] [-pw <password>] -t <targetDir>
       [-path <exportPathPattern>] [-pf <exportPathPatternFile>] [-lpf <linesPerFile>]
       [-timeout <timeout>] [-help]

2.3 运行示例

# 导出 root.ln路径下的元数据
./export-schema.sh -t /home/ -path "root.ln.**"

# 导出结果内容格式如下
Timeseries,Alias,DataType,Encoding,Compression
root.ln.wf02.wt02.status,,BOOLEAN,RLE,LZ4
root.ln.wf02.wt02.hardware,,TEXT,PLAIN,LZ4