提交 27286ae9 编写于 作者: H Haonan 提交者: Jiang Tian

0.9.0 documents (#500)

上级 d0a53e80
......@@ -125,7 +125,7 @@ configuration files are under "conf" folder
* system config module (`tsfile-format.properties`, `iotdb-engine.properties`)
* log config module (`logback.xml`).
For more, see [Chapter4: Deployment and Management](https://iotdb.apache.org/#/Documents/0.8.0/chap4/sec1) in detail.
For more, see [Chapter3: Server](https://iotdb.apache.org/#/Documents/progress/chap3/sec1) and [Chapter4: Client](https://iotdb.apache.org/#/Documents/progress/chap4/sec1) in detail.
## Start
......
......@@ -41,14 +41,12 @@
# 快速入门
本文将介绍关于IoTDB使用的基本流程,如果需要更多信息,请浏览我们官网的[指引](https://iotdb.apache.org/#/Documents/0.8.0/chap1/sec1).
本文将介绍关于IoTDB使用的基本流程,如果需要更多信息,请浏览我们官网的[指引](https://iotdb.apache.org/#/Documents/progress/chap1/sec1).
## 安装环境
安装前需要保证设备上配有JDK>=1.8的运行环境,并配置好JAVA_HOME环境变量。
如需从源码进行编译,还需要Maven>=3.1的运行环境。
设置最大文件打开数为65535。
## IoTDB安装
......@@ -61,23 +59,9 @@ IoTDB支持多种安装途径。用户可以使用三种方式对IoTDB进行安
* 使用Docker镜像: dockerfile文件位于 https://github.com/apache/incubator-iotdb/blob/master/docker/Dockerfile
### 从源代码生成
您可以从代码仓库下载源码:
```
git clone https://github.com/apache/incubator-iotdb.git
```
### IoTDB下载
接下来在incubator-iotdb的根目录下执行以下命令:
```
> mvn clean package -DskipTests
```
执行完成后对应的二进制文件(包括服务器和客户端)都可以在**distribution/target/apache-iotdb-{project.version}-incubating-bin.zip**位置找到。
> 注意需要在源代码根目录添加目录"service-rpc/target/generated-sources/thrift"与"server/target/generated-sources/antlr3",以避免在IDE中的编译错误。
您可以从这里下载程序:[下载](https://iotdb.apache.org/#/Download)
### 配置文件
......@@ -87,7 +71,7 @@ git clone https://github.com/apache/incubator-iotdb.git
* 系统配置模块 (`tsfile-format.properties`, `iotdb-engine.properties`)
* 日志配置模块 (`logback.xml`).
想要了解更多,请浏览[Chapter3: Deployment](https://iotdb.apache.org/#/Documents/progress/chap3/sec1)
想要了解更多,请浏览[Chapter3: Server](https://iotdb.apache.org/#/Documents/progress/chap3/sec1)
## IoTDB试用
......@@ -280,7 +264,7 @@ IoTDB> quit
IoTDB> exit
```
想要浏览更多IoTDB数据库支持的命令,请浏览[IoTDB SQL Documentation](https://iotdb.apache.org/#/Documents/progress/chap4/sec7).
想要浏览更多IoTDB数据库支持的命令,请浏览[SQL Reference](https://iotdb.apache.org/#/Documents/progress/chap5/sec4).
### 停止IoTDB
......@@ -297,23 +281,3 @@ Windows系统停止命令如下:
```
> $sbin\stop-server.bat
```
##单独打包服务器
在incubator-iotdb的根目录下执行
```
> mvn clean package -pl server -am -DskipTests
```
在生成完毕之后,IoTDB服务器位于文件夹"server/target/iotdb-server-{project.version}"中。
##单独打包客户端
在incubator-iotdb的根目录下执行
```
> mvn clean package -pl client -am -DskipTests
```
在生成完毕之后,IoTDB的cli工具位于文件夹"client/target/iotdb-client-{project.version}"中。
\ No newline at end of file
......@@ -28,4 +28,4 @@ Apache IoTDB 始于清华大学软件学院。IoTDB是一个用于管理大量
* [PISA: An Index for Aggregating Big Time Series Data](https://dl.acm.org/citation.cfm?id=2983775&dl=ACM&coll=DL), Xiangdong Huang and Jianmin Wang and Raymond K. Wong and Jinrui Zhang and Chen Wang. CIKM 2016.
* [Matching Consecutive Subpatterns over Streaming Time Series](https://link.springer.com/chapter/10.1007/978-3-319-96893-3_8), Rong Kang and Chen Wang and Peng Wang and Yuting Ding and Jianmin Wang. APWeb/WAIM 2018.
* [KV-match: A Subsequence Matching Approach Supporting Normalization and Time Warping](https://www.semanticscholar.org/paper/KV-match%3A-A-Subsequence-Matching-Approach-and-Time-Wu-Wang/9ed84cb15b7e5052028fc5b4d667248713ac8592), Jiaye Wu and Peng Wang and Chen Wang and Wei Wang and Jianmin Wang. ICDE 2019.
* 我们还研发了面向时间序列数据库的Benchmark工具: https://github.com/thulab/iotdb-benchmark
* 我们还研发了面向时间序列数据库的Benchmark工具: [https://github.com/thulab/iotdb-benchmark](https://github.com/thulab/iotdb-benchmark)
......@@ -27,7 +27,7 @@ IoTDB套件由若干个组件构成,共同形成“数据收集-数据写入-
图1.1展示了使用IoTDB套件全部组件后形成的整体应用架构。下文称所有组件形成IoTDB套件,而IoTDB特指其中的时间序列数据库组件。
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51578977-4d5b5800-1efa-11e9-9d6e-6bfe7e890f30.jpg">
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/25913899/67943956-39c1e800-fc16-11e9-8da2-a662f8246816.png">
在图1.1中,用户可以通过JDBC将来自设备上传感器采集的时序数据、服务器负载和CPU内存等系统状态数据、消息队列中的时序数据、应用程序的时序数据或者其他数据库中的时序数据导入到本地或者远程的IoTDB中。用户还可以将上述数据直接写成本地(或位于HDFS上)的TsFile文件。
......
......@@ -40,12 +40,12 @@ IoTDB具有以下特点:
* 以及同时具备上述特点的混合负载
* 面向时间序列的丰富查询语义
* 跨设备、跨传感器的时间序列时间对齐
* 面向时序数据特征的计算(频域变换,0.7.0版本不支持)
* 面向时序数据特征的计算
* 提供面向时间维度的丰富聚合函数支持
* 极低的学习门槛
* 支持类SQL的数据操作
* 提供JDBC的编程接口
* 完善的导入导出工具(0.7.0版本不支持)
* 完善的导入导出工具
* 完美对接开源生态环境
* 支持开源数据分析生态系统:Hadoop、Spark
* 支持开源可视化工具对接:Grafana
......@@ -20,9 +20,21 @@
-->
# 第2章 IoTDB基本概念
## 主要概念及术语
## 数据模型与技术
IoTDB中涉及如下基本概念:
我们为您提供一份简化的[样例数据](https://github.com/apache/incubator-iotdb/blob/master/docs/Documentation/OtherMaterial-Sample%20Data.txt)
下载文件: [IoTDB-SampleData.txt](https://raw.githubusercontent.com/apache/incubator-iotdb/master/docs/Documentation/OtherMaterial-Sample%20Data.txt).
根据本文描述的[数据](https://github.com/apache/incubator-iotdb/blob/master/docs/Documentation/OtherMaterial-Sample%20Data.txt)属性层级,按照属性涵盖范围以及它们之间的从属关系,我们可将其表示为如下图2.1的属性层级组织结构,其层级关系为:集团层-电场层-设备层-传感器层。其中ROOT为根节点,传感器层的每一个节点称为叶子节点。在使用IoTDB的过程中,您可以直接将由ROOT节点到每一个叶子节点路径上的属性用“.”连接,将其作为一个IoTDB的时间序列的名称。图2.1中最左侧的路径可以生成一个名为`ROOT.ln.wf01.wt01.status`的时间序列。
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577327-7aa50780-1ef4-11e9-9d75-cadabb62444e.jpg">
**图2.1 属性层级组织结构**</center>
得到时间序列的名称之后,我们需要根据数据的实际场景和规模设置存储组。由于在本文所述场景中,每次到达的数据通常以集团为单位(即数据可能为跨电场、跨设备的),为了写入数据时避免频繁切换IO降低系统速度,且满足用户以集团为单位进行物理隔离数据的要求,我们将存储组设置在集团层。
根据模型结构,IoTDB中涉及如下基本概念:
* 设备
......@@ -206,14 +218,3 @@ IoTDB在显示时间戳时可以支持LONG类型以及DATETIME-DISPLAY类型,
```
> 注意:'+'和'—'的左右两边必须有空格
*
一个时间序列的值是由实际中的传感器向IoTDB发送的数值。这个值可以按照数据类型被IoTDB存储,同时用户也可以针对这个值的数据类型选择压缩方式,以及对应的编码方式。数据类型与对应编码的详细信息请参见本文[数据类型](/#/Documents/0.8.0/chap2/sec2)[编码方式](/#/Documents/latest/chap2/sec3)节。
* 数据点
一个数据点是由一个时间戳-值对(timestamp, value)组成的。
* 数据的列
一个数据的列包含属于一个时间序列的所有值以及这些值相对应的时间戳。当有多个数据的列时,IoTDB会针对时间戳做合并,变为多个<时间戳-多值>对(timestamp, value, value, …)。
......@@ -32,7 +32,7 @@ IoTDB支持:
一共六种数据类型。
其中**FLOAT****DOUBLE**类型的序列,如果编码方式采用[RLE](/#/Documents/progress/chap2/sec3)[TS_2DIFF](/#/Documents/progress/chap2/sec3)可以指定MAX_POINT_NUMBER,该项为浮点数的小数点后位数,具体指定方式请参见本文[4.7节](/#/Documents/progress/chap4/sec7),若不指定则系统会根据配置文件`tsfile-format.properties`文件中的[float_precision项](/#/Documents/progress/chap3/sec2)配置。
其中**FLOAT****DOUBLE**类型的序列,如果编码方式采用[RLE](/#/Documents/progress/chap2/sec3)[TS_2DIFF](/#/Documents/progress/chap2/sec3)可以指定MAX_POINT_NUMBER,该项为浮点数的小数点后位数,具体指定方式请参见本文[5.4节](/#/Documents/progress/chap5/sec4),若不指定则系统会根据配置文件`tsfile-format.properties`文件中的[float_precision项](/#/Documents/progress/chap3/sec4)配置。
当系统中用户输入的数据类型与该时间序列的数据类型不对应时,系统会提醒类型错误,如下所示,二阶差分不支持布尔类型的编码:
......
......@@ -33,13 +33,13 @@ PLAIN编码,默认的编码方式,即不编码,支持多种数据类型,
二阶差分编码,比较适合编码单调递增或者递减的序列数据,不适合编码波动较大的数据。
二阶差分编码也可用于对浮点数进行编码,但在创建时间序列的时候需指定保留小数位数(MAX_POINT_NUMBER,具体指定方式参见本文[第5.1节](/#/Documents/0.8.0/chap5/sec1))。比较适合存储某些浮点数值连续出现、单调调递增或者递减的序列数据,不适合存储对小数点后精度要求较高以及前后波动较大的序列数据。
二阶差分编码也可用于对浮点数进行编码,但在创建时间序列的时候需指定保留小数位数(MAX_POINT_NUMBER,具体指定方式参见本文[第5.4节](/#/Documents/progress/chap5/sec4))。比较适合存储某些浮点数值连续出现、单调调递增或者递减的序列数据,不适合存储对小数点后精度要求较高以及前后波动较大的序列数据。
* 游程编码(RLE)
游程编码,比较适合存储某些整数值连续出现的序列,不适合编码大部分情况下前后值不一样的序列数据。
游程编码也可用于对浮点数进行编码,,但在创建时间序列的时候需指定保留小数位数(MAX_POINT_NUMBER,具体指定方式参见本文本文[第5.1节](/#/Documents/0.8.0/chap5/sec1))。比较适合存储某些浮点数值连续出现的序列数据,不适合存储对小数点后精度要求较高以及前后波动较大的序列数据。
游程编码也可用于对浮点数进行编码,,但在创建时间序列的时候需指定保留小数位数(MAX_POINT_NUMBER,具体指定方式参见本文本文[第5.4节](/#/Documents/progress/chap5/sec4))。比较适合存储某些浮点数值连续出现的序列数据,不适合存储对小数点后精度要求较高以及前后波动较大的序列数据。
* GORILLA编码(GORILLA)
......
......@@ -25,4 +25,9 @@
当时间序列写入并按照指定的类型编码为二进制数据后,IoTDB会使用压缩技术对该数据进行压缩,进一步提升空间存储效率。虽然编码和压缩都旨在提升存储效率,但编码技术通常只适合特定的数据类型(如二阶差分编码只适合与INT32或者INT64编码,存储浮点数需要先将他们乘以10m以转换为整数),然后将它们转换为二进制流。压缩方式(SNAPPY)针对二进制流进行压缩,因此压缩方式的使用不再受数据类型的限制。
IoTDB允许在创建一个时间序列的时候指定该列的压缩方式。现阶段IoTDB现在支持的压缩方式有两种:UNCOMPRESSOR(不压缩)和SNAPPY压缩。压缩方式的指定语法详见本文[4.7节](/#/Documents/progress/chap4/sec7)
IoTDB允许在创建一个时间序列的时候指定该列的压缩方式。现阶段IoTDB现在支持的压缩方式有两种:
* UNCOMPRESSOR(不压缩)
* SNAPPY压缩
压缩方式的指定语法详见本文[5.4节](/#/Documents/progress/chap5/sec4)
......@@ -19,9 +19,9 @@
-->
# 第3章 系统部署
# 第3章 服务器端
## 系统部署
## 下载
IoTDB为您提供了两种安装方式,您可以参考下面的建议,任选其中一种:
......@@ -35,8 +35,9 @@ IoTDB为您提供了两种安装方式,您可以参考下面的建议,任选
如果您需要从源码进行编译,还需要安装:
1. Maven>=3.0的运行环境,具体安装方法可以参考以下链接:[https://maven.apache.org/install.html](https://maven.apache.org/install.html)
1. Maven>=3.1的运行环境,具体安装方法可以参考以下链接:[https://maven.apache.org/install.html](https://maven.apache.org/install.html)
> 注: 也可以选择不安装,使用我们提供的'mvnw.sh' 或 'mvnw.cmd' 工具。使用时请用'mvnw.sh' 或 'mvnw.cmd'命令代替下文的'mvn'命令。
### 从官网下载二进制可执行文件
......
......@@ -18,6 +18,6 @@
under the License.
-->
# 第3章: 系统部署
# 第3章: 服务器端
Coming Soon.
\ No newline at end of file
......@@ -18,6 +18,6 @@
under the License.
-->
# 第6章: API
# 第3章: 服务器端
Coming Soon.
\ No newline at end of file
......@@ -19,6 +19,6 @@
-->
# 第8章: TsFile
# 第3章 服务器端
Coming Soon.
\ No newline at end of file
......@@ -20,19 +20,29 @@
-->
<!-- TOC -->
# 第4章 IoTDB操作指南
# 第4章 客户端
## 概览
- Cli / Shell工具
- Cli / Shell安装
- Cli / Shell运行方式
- Cli / Shell运行参数
- Cli / Shell的-e参数
<!-- /TOC -->
# Cli / Shell工具
# Command Line Interface(CLI)
IOTDB为用户提供Client/Shell工具用于启动客户端和服务端程序。下面介绍每个Client/Shell工具的运行方式和相关参数。
> \$IOTDB\_HOME表示IoTDB的安装目录所在路径。
## Cli / Shell安装
在incubator-iotdb的根目录下执行
```
> mvn clean package -pl client -am -DskipTests
```
在生成完毕之后,IoTDB的cli工具位于文件夹"client/target/iotdb-client-{project.version}"中。
## Cli / Shell运行方式
安装后的IoTDB中有一个默认用户:`root`,默认密码为`root`。用户可以使用该用户尝试运行IoTDB客户端以测试服务器是否正常启动。客户端启动脚本为$IOTDB_HOME/bin文件夹下的`start-client`脚本。启动脚本时需要指定运行IP和PORT。以下为服务器在本机启动,且用户未更改运行端口号的示例,默认端口为6667。若用户尝试连接远程服务器或更改了服务器运行的端口号,请在-h和-p项处使用服务器的IP和PORT。
......
......@@ -19,9 +19,9 @@
-->
# 第6章: API
# 第4章: 客户端
## JDBC API
## 编程 - JDBC
Coming soon.
......
......@@ -19,9 +19,9 @@
-->
# 第6章: API
# 第4章: 客户端
# Session API
# 编程 - Session
## 依赖
......
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# 第4章: 客户端
## 其他语言
Coming Soon.
\ No newline at end of file
......@@ -7,9 +7,9 @@
to you 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
......@@ -18,6 +18,6 @@
under the License.
-->
# 第10章: 生态集成
Coming Soon.
\ No newline at end of file
# 第4章: 客户端
## TsFile API
\ No newline at end of file
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# 第4章 IoTDB操作指南
## 数据维护
<!-- >
### 数据更新
用户使用[UPDATE语句](/#/Documents/0.8.0/chap5/sec1)可以更新指定的时间序列中一段时间的数据。在更新数据时,用户可以选择需要更新的一个时间序列(0.8.0版本暂不支持多个时间序列的更新)并指定更新某个时间点或时间段的数据(0.8.0版本必须有时间过滤条件)。
在JAVA编程环境中,您可以使用[JDBC API](/#/Documents/0.8.0/chap6/sec1)单条或批量执行UPDATE语句。
#### 单传感器时间序列值更新
以测控ln集团wf02子站wt02设备供电状态为例,存在这样的使用场景:
当数据接入并分析后,发现从2017-11-01 15:54:00到2017-11-01 16:00:00内的供电状态为true,但实际供电状态存在异常。需要将这段时间状态更新为false。进行此操作的SQL语句为:
```
update root.ln.wf02 SET wt02.status = false where time <=2017-11-01T16:00:00 and time >= 2017-11-01T15:54:00
```
需要注意的是,当更新数据类型与实际类型不符时,IoTDB会给出相应的错误提示:
```
IoTDB> update root.ln.wf02 set wt02.status = 1205 where time < now()
error: The BOOLEAN data type should be true/TRUE or false/FALSE
```
当更新的列不存在时,IoTDB给出没有存在的路径的错误提示:
```
IoTDB> update root.ln.wf02 set wt02.sta = false where time < now()
Msg: do not select any existing series
```
-->
### 数据删除
用户使用[DELETE语句](/#/Documents/progress/chap4/sec7)可以删除指定的时间序列中符合时间删除条件的数据。在删除数据时,用户可以选择需要删除的一个或多个时间序列、时间序列的前缀、时间序列带*路径对某时间之前的数据进行删除(当前版本暂不支持删除某一闭时间区间范围内的数据)。
在JAVA编程环境中,您可以使用[JDBC API](/#/Documents/progress/chap6/sec1)单条或批量执行UPDATE语句。
#### 单传感器时间序列值删除
以测控ln集团为例,存在这样的使用场景:
wf02子站的wt02设备在2017-11-01 16:26:00之前的供电状态出现多段错误,且无法分析其正确数据,错误数据影响了与其他设备的关联分析。此时,需要将此时间段前的数据删除。进行此操作的SQL语句为:
```
delete from root.ln.wf02.wt02.status where time<=2017-11-01T16:26:00;
```
#### 多传感器时间序列值删除
当ln集团wf02子站的wt02设备在2017-11-01 16:26:00之前的供电状态和设备硬件版本都需要删除,此时可以使用含义更广的[前缀路径或带`*`路径](/#/Documents/progress/chap2/sec1)进行删除操作,进行此操作的SQL语句为:
```
delete from root.ln.wf02.wt02 where time <= 2017-11-01T16:26:00;
```
```
delete from root.ln.wf02.wt02.* where time <= 2017-11-01T16:26:00;
```
需要注意的是,当删除的路径不存在时,IoTDB会提示路径不存在,无法删除数据,如下所示。
```
IoTDB> delete from root.ln.wf03.wt02.status where time < now()
Msg: TimeSeries does not exist and its data cannot be deleted
```
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# 第4章 IoTDB操作指南
Coming Soon.
\ No newline at end of file
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# 第5章 系统管理
## 性能监控
### 引言
性能监控模块用来监控IOTDB每一个操作的耗时,以便用户更好的了解数据库的整体性能。此模块会统计每一种操作的平均耗时,以及耗时在一定时间区间内(1ms,4ms,16ms,64ms,256ms,1024ms,以上)的操作的比例。输出文件在log_measure.log中。输出样例如下:
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/60937461-14296f80-a303-11e9-9602-a7bed624bfb3.png">
### 配置参数
配置文件位置:conf/iotdb-engine.properties
<center>**表 -配置参数以及描述项**
|参数|默认值|描述|
|:---|:---|:---|
|enable\_performance\_stat|false|是否开启性能监控模块|
|performance\_stat\_display\_interval|60000|打印统计结果的时间延迟,以毫秒为单位|
|performance_stat_memory_in_kb|20|性能监控模块使用的内存阈值,单位为KB|
</center>
### 利用JMX MBean动态调节参数
通过端口31999连接jconsole,并在上方菜单项中选择‘MBean’. 展开侧边框并选择 'org.apache.iotdb.db.cost.statistic'. 将会得到如下图所示结果:
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/60937484-30c5a780-a303-11e9-8e92-04c413df2088.png">
**属性**
1. EnableStat:是否开启性能监控模块,如果被设置为true,则性能监控模块会记录每个操作的耗时并打印结果。这个参数不能直接通过jconsole直接更改,但可通过下方的函数来进行动态设置。
2. DisplayIntervalInMs:相邻两次打印结果的时间间隔。这个参数可以直接设置,但它要等性能监控模块重启才会生效。重启性能监控模块可以通过先调用 stopStatistic()然后调用startContinuousStatistics()或者直接调用 startOneTimeStatistics()实现。
3. OperationSwitch:这个属性用来展示针对每一种操作是否开启了监控统计,map的键为操作的名字,值为是否针对这种操作开启性能监控。这个参数不能直接通过jconsole直接更改,但可通过下方的 'changeOperationSwitch()'函数来进行动态设置。
**操作**
1. startContinuousStatistics:开启性能监控并以‘DisplayIntervalInMs’的时间间隔打印统计结果。
2. startOneTimeStatistics:开启性能监控并以‘DisplayIntervalInMs’的时间延迟打印一次统计结果。
3. stopStatistic:关闭性能监控。
4. clearStatisticalState(): 清除以统计的结果,从新开始统计。
5. changeOperationSwitch(String operationName, Boolean operationState):设置是否针对每一种不同的操作开启监控。参数‘operationName是操作的名称,在OperationSwitch属性中展示了所有操作的名称。参数 ‘operationState’是操作的状态,打开或者关闭。如果状态设置成功则此函数会返回true,否则返回false。
### 自定义操作类型监控其他区域
**增加操作项**
在org.apache.iotdb.db.cost.statistic.Operation类中增加一个枚举项来表示新增的操作.
**在监控区域增加监控代码**
在监控开始区域增加计时代码:
long t0 = System. currentTimeMillis();
在监控结束区域增加记录代码:
Measurement.INSTANCE.addOperationLatency(Operation, t0);
## cache命中率统计
### 概述
为了提高查询性能,IOTDB对ChunkMetaData和TsFileMetaData进行了缓存。用户可以通过debug级别的日志以及MXBean两种方式来查看缓存的命中率,并根据缓存命中率以及系统内存来调节缓存所使用的内存大小。使用MXBean查看缓存命中率的方法为:
1. 通过端口31999连接jconsole,并在上方菜单项中选择‘MBean’.
2. 展开侧边框并选择 'org.apache.iotdb.db.service'. 将会得到如下图所示结果:
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/65687623-404fc380-e09c-11e9-83c3-3c7c63a5b0be.jpeg">
\ No newline at end of file
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# 第5章 系统管理
## 系统日志
IoTDB支持用户通过修改日志配置文件的方式对IoTDB系统日志(如日志输出级别等)进行配置,系统日志配置文件默认位置在$IOTDB_HOME/conf文件夹下,默认的日志配置文件名为logback.xml。用户可以通过增加或更改其中的xml树型节点参数对系统运行日志的相关配置进行修改。需要说明的是,使用日志配置文件对系统日志进行配置并非修改完文件立刻生效,而是重启IoTDB系统后生效。详细配置说明参看本文日志文件配置说明。
同时,为了方便在系统运行过程中运维人员对系统的调试,我们为系统运维人员提供了动态修改日志配置的JMX接口,能够在系统不重启的前提下实时对系统的Log模块进行配置。详细使用方法参看动态系统日志配置说明)。
### 动态系统日志配置说明
#### 连接JMX
本节以Jconsole为例介绍连接JMX并进入动态系统日志配置模块的方法。启动Jconsole控制页面,在新建连接处建立与IoTDB Server的JMX连接(可以选择本地进程或给定IoTDB的IP及PORT进行远程连接,IoTDB的JMX服务默认运行端口为31999),如下图使用远程进程连接Localhost下运行在31999端口的IoTDB JMX服务。
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577195-f94d7500-1ef3-11e9-999a-b4f67055d80e.png">
连接到JMX后,您可以通过MBean选项卡找到名为`ch.qos.logback.classic``MBean`,如下图所示。
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577204-fe122900-1ef3-11e9-9e89-2eb1d46e24b8.png">
`ch.qos.logback.classic`的MBean操作(Operations)选项中,可以看到当前动态系统日志配置支持的5种接口,您可以通过使用相应的方法,来执行相应的操作,操作页面如图。
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577216-09fdeb00-1ef4-11e9-9005-542ad7d9e9e0.png">
#### 动态系统日志接口说明
* reloadDefaultConfiguration接口
该方法为重新加载默认的logback配置文件,用户可以先对默认的配置文件进行修改,然后调用该方法将修改后的配置文件重新加载到系统中,使其生效。
* reloadByFileName接口
该方法为加载一个指定路径的logback配置文件,并使其生效。该方法接受一个名为p1的String类型的参数,该参数为需要指定加载的配置文件路径。
* getLoggerEffectiveLevel接口
该方法为获取指定Logger当前生效的日志级别。该方法接受一个名为p1的String类型的参数,该参数为指定Logger的名称。该方法返回指定Logger当前生效的日志级别。
* getLoggerLevel接口
该方法为获取指定Logger的日志级别。该方法接受一个名为p1的String类型的参数,该参数为指定Logger的名称。该方法返回指定Logger的日志级别。
需要注意的是,该方法与`getLoggerEffectiveLevel`方法的区别在于,该方法返回的是指定Logger在配置文件中被设定的日志级别,如果用户没有对该Logger进行日志级别的设定,则返回空。按照Logback的日志级别继承机制,如果一个Logger没有被显示地设定日志级别,其将会从其最近的祖先继承日志级别的设定。这时,调用`getLoggerEffectiveLevel`方法将返回该Logger生效的日志级别;而调用本节所述方法,将返回空。
......@@ -19,32 +19,12 @@
-->
# 第4章 IoTDB操作指南
## 样例数据
我们为您提供一份简化的[样例数据](https://github.com/apache/incubator-iotdb/blob/master/docs/Documentation/OtherMaterial-Sample%20Data.txt)
下载文件: [IoTDB-SampleData.txt](https://raw.githubusercontent.com/apache/incubator-iotdb/master/docs/Documentation/OtherMaterial-Sample%20Data.txt).
## 数据模型选用与创建
在向IoTDB导入数据之前,首先要根据样例数据选择合适的数据存储模型,然后使用[SET STORAGE GROUP](/#/Documents/progress/chap4/sec7)语句和[CREATE TIMESERIES](/#/Documents/progress/chap4/sec7)语句设置存储组,并创建时间序列。
### 选用存储模型
根据本文描述的[数据](https://github.com/apache/incubator-iotdb/blob/master/docs/Documentation/OtherMaterial-Sample%20Data.txt)属性层级,按照属性涵盖范围以及它们之间的从属关系,我们可将其表示为如下图3.1的属性层级组织结构,其层级关系为:集团层-电场层-设备层-传感器层。其中ROOT为根节点,传感器层的每一个节点称为叶子节点。在使用IoTDB的过程中,您可以直接将由ROOT节点到每一个叶子节点路径上的属性用“.”连接,将其作为一个IoTDB的时间序列的名称。图3.1中最左侧的路径可以生成一个名为`ROOT.ln.wf01.wt01.status`的时间序列。
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577327-7aa50780-1ef4-11e9-9d75-cadabb62444e.jpg">
**图3.1 属性层级组织结构**</center>
得到时间序列的名称之后,我们需要根据数据的实际场景和规模设置存储组。由于在本文所述场景中,每次到达的数据通常以集团为单位(即数据可能为跨电场、跨设备的),为了写入数据时避免频繁切换IO降低系统速度,且满足用户以集团为单位进行物理隔离数据的要求,我们将存储组设置在集团层。
# 第5章 IoTDB操作指南
## DDL (数据定义语言)
### 创建存储组
存储模型选用后,我们可以根据存储模型建立相应的存储组。创建存储组的SQL语句如下所示:
我们可以根据存储模型建立相应的存储组。创建存储组的SQL语句如下所示:
```
IoTDB > set storage group to root.ln
......@@ -62,7 +42,7 @@ Msg: org.apache.iotdb.exception.MetadataErrorException: org.apache.iotdb.excepti
### 查看存储组
在存储组创建后,我们可以使用[SHOW STORAGE GROUP](/#/Documents/progress/chap4/sec7)语句来查看所有的存储组,SQL语句如下所示:
在存储组创建后,我们可以使用[SHOW STORAGE GROUP](/#/Documents/progress/chap5/sec4)语句来查看所有的存储组,SQL语句如下所示:
```
IoTDB> show storage group
......@@ -112,10 +92,45 @@ IoTDB> show timeseries root.ln
需要注意的是,当查询路径不存在时,系统会返回0条时间序列。
### 注意事项
### 统计时间序列总数
IoTDB支持使用`COUNT TIMESERIES<Path>`来统计一条路径中的时间序列个数。SQL语句如下所示:
```
IoTDB > COUNT TIMESERIES root
IoTDB > COUNT TIMESERIES root.ln
IoTDB > COUNT TIMESERIES root.ln.*.*.status
IoTDB > COUNT TIMESERIES root.ln.wf01.wt01.status
```
### 删除时间序列
我们可以使用`DELETE TimeSeries <PrefixPath>`语句来删除我们之前创建的时间序列。SQL语句如下所示:
```
IoTDB> delete timeseries root.ln.wf01.wt01.status
IoTDB> delete timeseries root.ln.wf01.wt01.temperature, root.ln.wf02.wt02.hardware
IoTDB> delete timeseries root.ln.wf02*
```
### 查看设备
我们可以通过使用`SHOW DEVICES`语句查看当前所有设备。SQL语句如下所示:
```
IoTDB> show devices
```
当前版本对用户操作的数据规模进行一些限制:
## TTL
IoTDB支持对存储组级别设置数据存活时间(TTL),这使得IoTDB可以定期、自动地删除一定时间之前的数据。合理使用TTL
可以帮助您控制IoTDB占用的总磁盘空间以避免出现磁盘写满等异常。并且,随着文件数量的增多,查询性能往往随之下降,
内存占用也会有所提高。及时地删除一些较老的文件有助于使查询性能维持在一个较高的水平和减少内存资源的占用。
### 设置 TTL
设置TTL的SQL语句如下所示:
```
IoTDB> set ttl to root.ln 3600000
```
这个例子表示在`root.ln`存储组中,只有最近一个小时的数据将会保存,旧数据会被移除或不可见。
### 取消 TTL
```
IoTDB> set ttl to root.ln 3600000。
```
限制1:假设运行时IoTDB分配到的JVM内存大小为p,用户自定义的每次将内存中的数据写入到磁盘时的大小([group_size_in_byte](/#/Documents/progress/chap3/sec2))为q。存储组的数量不能超过p/q。
限制2:时间序列的数量不超过运行时IoTDB分配到的JVM内存与20KB的比值。
......@@ -19,21 +19,16 @@
-->
# 第4章 IoTDB操作指南
# 第5章 IoTDB操作指南
## DML (数据操作语言)
## 数据接入
### 历史数据导入
0.7.0版本中暂不支持此功能。
### 实时数据接入
IoTDB为用户提供多种插入实时数据的方式,例如在[Cli/Shell工具](/#/Documents/progress/chap4/sec1)中直接输入插入数据的INSERT语句,或使用Java API(标准[Java JDBC](/#/Documents/progress/chap4/sec2)接口)单条或批量执行插入数据的INSERT语句。
IoTDB为用户提供多种插入实时数据的方式,例如在[Cli/Shell工具](/#/Documents/progress/chap4/sec1)中直接输入插入数据的[INSERT语句](/#/Documents/progress/chap4/sec7),或使用Java API(标准[Java JDBC](/#/Documents/progress/chap6/sec1)接口)单条或批量执行插入数据的[INSERT语句](/#/Documents/progress/chap4/sec7)
本节主要为您介绍实时数据接入的INSERT语句在场景中的实际使用示例,有关INSERT SQL语句的详细语法请参见本文[INSERT语句](/#/Documents/progress/chap5/sec4)
本节主要为您介绍实时数据接入的[INSERT语句](/#/Documents/progress/chap4/sec7)在场景中的实际使用示例,有关INSERT SQL语句的详细语法请参见本文[INSERT语句](/#/Documents/progress/chap4/sec7)节。
#### 使用INSERT语句
使用[INSERT语句](/#/Documents/progress/chap4/sec7)可以向指定的已经创建的一条或多条时间序列中插入数据。对于每一条数据,均由一个时间戳类型的[时间戳](/#/Documents/progress/chap2/sec1)和一个[数值或布尔值、字符串类型](/#/Documents/progress/chap2/sec2)的传感器采集值组成。
### 使用INSERT语句
使用INSERT语句可以向指定的已经创建的一条或多条时间序列中插入数据。对于每一条数据,均由一个时间戳类型的时间戳和一个数值或布尔值、字符串类型的传感器采集值组成。
在本节的场景实例下,以其中的两个时间序列`root.ln.wf02.wt02.status``root.ln.wf02.wt02.hardware`为例 ,它们的数据类型分别为BOOLEAN和TEXT。
......@@ -83,3 +78,116 @@ IoTDB > insert into root.ln.wf02.wt02(timestamp,hardware) values(1,100)
```
error: The TEXT data type should be covered by " or '
```
## 数据查询
### 时间切片查询
本节主要介绍时间切片查询的相关示例,主要使用的是[IoTDB SELECT语句](/#/Documents/progress/chap5/sec4)。同时,您也可以使用[Java JDBC](/#/Documents/progress/chap4/sec2)标准接口来执行相关的查询语句。
#### 根据一个时间区间选择一列数据
SQL语句为:
```
select temperature from root.ln.wf01.wt01 where time < 2017-11-01T00:08:00.000
```
其含义为:
被选择的设备为ln集团wf01子站wt01设备;被选择的时间序列为温度传感器(temperature);该语句要求选择出该设备在“2017-11-01T00:08:00.000”(此处可以使用多种时间格式,详情可参看[2.1节](/#/Documents/progress/chap2/sec1))时间点以前的所有温度传感器的值。
该SQL语句的执行结果如下:
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/23614968/61280074-da1c0a00-a7e9-11e9-8eb8-3809428043a8.png"></center>
#### 根据一个时间区间选择多列数据
SQL语句为:
```
select status, temperature from root.ln.wf01.wt01 where time > 2017-11-01T00:05:00.000 and time < 2017-11-01T00:12:00.000;
```
其含义为:
被选择的设备为ln集团wf01子站wt01设备;被选择的时间序列为供电状态(status)和温度传感器(temperature);该语句要求选择出“2017-11-01T00:05:00.000”至“2017-11-01T00:12:00.000”之间的所选时间序列的值。
该SQL语句的执行结果如下:
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/23614968/61280328-40a12800-a7ea-11e9-85b9-3b8db67673a3.png"></center>
#### 按照多个时间区间选择同一设备的多列数据
IoTDB支持在一次查询中指定多个时间区间条件,用户可以根据需求随意组合时间区间条件。例如,
SQL语句为:
```
select status,temperature from root.ln.wf01.wt01 where (time > 2017-11-01T00:05:00.000 and time < 2017-11-01T00:12:00.000) or (time >= 2017-11-01T16:35:00.000 and time <= 2017-11-01T16:37:00.000);
```
其含义为:
被选择的设备为ln集团wf01子站wt01设备;被选择的时间序列为“供电状态(status)”和“温度传感器(temperature)”;该语句指定了两个不同的时间区间,分别为“2017-11-01T00:05:00.000至2017-11-01T00:12:00.000”和“2017-11-01T16:35:00.000至2017-11-01T16:37:00.000”;该语句要求选择出满足任一时间区间的被选时间序列的值。
该SQL语句的执行结果如下:
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/23614968/61280449-780fd480-a7ea-11e9-8ed0-70fa9dfda80f.png"></center>
#### 按照多个时间区间选择不同设备的多列数据
该系统支持在一次查询中选择任意列的数据,也就是说,被选择的列可以来源于不同的设备。例如,SQL语句为:
```
select wf01.wt01.status,wf02.wt02.hardware from root.ln where (time > 2017-11-01T00:05:00.000 and time < 2017-11-01T00:12:00.000) or (time >= 2017-11-01T16:35:00.000 and time <= 2017-11-01T16:37:00.000);
```
其含义为:
被选择的时间序列为“ln集团wf01子站wt01设备的供电状态”以及“ln集团wf02子站wt02设备的硬件版本”;该语句指定了两个时间区间,分别为“2017-11-01T00:05:00.000至2017-11-01T00:12:00.000”和“2017-11-01T16:35:00.000至2017-11-01T16:37:00.000”;该语句要求选择出满足任意时间区间的被选时间序列的值。
该SQL语句的执行结果如下:
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577450-dcfe0800-1ef4-11e9-9399-4ba2b2b7fb73.jpg"></center>
### 降频聚合查询
本章节主要介绍降频聚合查询的相关示例,主要使用的是IoTDB SELECT语句的[GROUP BY子句](/#/Documents/progress/chap5/sec4),该子句是IoTDB中用于根据用户给定划分条件对结果集进行划分,并对已划分的结果集进行聚合计算的语句。IoTDB支持根据时间间隔对结果集进行划分,默认结果按照时间升序排列。同时,您也可以使用Java JDBC标准接口来执行相关的查询语句。
GROUP BY语句为用户提供三类指定参数:
* 参数1:划分时间轴的时间间隔参数
* 参数2:时间轴划分原点参数(可选参数)
* 参数3:时间轴显示时间窗参数(一个或多个)
## 数据维护
### 数据删除
用户使用[DELETE语句](/#/Documents/progress/chap5/sec4)可以删除指定的时间序列中符合时间删除条件的数据。在删除数据时,用户可以选择需要删除的一个或多个时间序列、时间序列的前缀、时间序列带\*路径对某时间之前的数据进行删除(当前版本暂不支持删除某一闭时间区间范围内的数据)。
在JAVA编程环境中,您可以使用JDBC API单条或批量执行DELETE语句。
#### 单传感器时间序列值删除
以测控ln集团为例,存在这样的使用场景:
wf02子站的wt02设备在2017-11-01 16:26:00之前的供电状态出现多段错误,且无法分析其正确数据,错误数据影响了与其他设备的关联分析。此时,需要将此时间段前的数据删除。进行此操作的SQL语句为:
```
delete from root.ln.wf02.wt02.status where time<=2017-11-01T16:26:00;
```
#### 多传感器时间序列值删除
当ln集团wf02子站的wt02设备在2017-11-01 16:26:00之前的供电状态和设备硬件版本都需要删除,此时可以使用含义更广的[前缀路径或带`*`路径](/#/Documents/progress/chap2/sec1)进行删除操作,进行此操作的SQL语句为:
```
delete from root.ln.wf02.wt02 where time <= 2017-11-01T16:26:00;
```
```
delete from root.ln.wf02.wt02.* where time <= 2017-11-01T16:26:00;
```
需要注意的是,当删除的路径不存在时,IoTDB会提示路径不存在,无法删除数据,如下所示。
```
IoTDB> delete from root.ln.wf03.wt02.status where time < now()
Msg: TimeSeries does not exist and its data cannot be deleted
```
......@@ -19,13 +19,13 @@
-->
# 第4章 IoTDB操作指南
# 第5章 IoTDB操作指南
## 权限管理
## 账户管理语句
IoTDB为用户提供了权限管理操作,从而为用户提供对于数据的权限管理功能,保障数据的安全。
我们将通过以下几个具体的例子为您示范基本的用户权限操作,详细的SQL语句及使用方式详情请参见本文[第5.1节](/#/Documents/progress/chap4/sec7)。同时,在JAVA编程环境中,您可以使用[JDBC API](/#/Documents/progress/chap6/sec1)单条或批量执行权限管理类语句。
我们将通过以下几个具体的例子为您示范基本的用户权限操作,详细的SQL语句及使用方式详情请参见本文[第5.4节](/#/Documents/progress/chap5/sec4)。同时,在JAVA编程环境中,您可以使用[JDBC API](/#/Documents/progress/chap4/sec2)单条或批量执行权限管理类语句。
### 基本概念
#### 用户
......@@ -46,7 +46,7 @@ IoTDB为用户提供了权限管理操作,从而为用户提供对于数据的
### 权限操作示例
根据本文中描述的[样例数据](/#/Documents/progress/chap4/sec2)内容,IoTDB的样例数据可能同时属于ln, sgcc等不同发电集团,不同的发电集团不希望其他发电集团获取自己的数据库数据,因此我们需要将不同的数据在集团层进行权限隔离。
根据本文中描述的[样例数据](/#/Documents/progress/chap5/sec1)内容,IoTDB的样例数据可能同时属于ln, sgcc等不同发电集团,不同的发电集团不希望其他发电集团获取自己的数据库数据,因此我们需要将不同的数据在集团层进行权限隔离。
#### 创建用户
......
......@@ -19,10 +19,8 @@
-->
# 第4章 IoTDB操作指南
## IoTDB查询语言
# 第5章 IoTDB操作指南
## SQL 参考文档
### Schema语句
......@@ -129,6 +127,13 @@ Note: The path can be prefix path or timeseries path.
Note: This statement can be used in IoTDB Client and JDBC.
```
* 显示设备语句
```
SHOW DEVICE
Eg: IoTDB > SHOW DEVICES
Note: This statement can be used in IoTDB Client and JDBC.
```
### 数据管理语句
* 插入记录语句
......@@ -439,7 +444,7 @@ Eg: IoTDB > LIST ALL USER OF ROLE roleuser;
ALTER USER <username> SET PASSWORD <password>;
roleName:=identifier
password:=string
Eg: IoTDB > UPDATE USER tempuser SET PASSWORD 'newpwd';
Eg: IoTDB > ALTER USER tempuser SET PASSWORD newpwd;
```
### 功能
......
......@@ -19,8 +19,8 @@
-->
# 第5章 系统管理
# 第6章: 系统工具
## 监控与日志工具
## 系统监控
当前用户可以使用Java的JConsole工具对正在运行的IoTDB进程进行系统状态监控,或使用IoTDB为用户开放的接口查看数据统计量。
......@@ -33,13 +33,13 @@
本模块是IoTDB为用户提供的对其中存储数据信息的数据统计监控方式,我们会在系统中为您记录各个模块的数据统计信息,并将其汇总存入数据库中。当前版本的IoTDB提供IoTDB写入数据的统计功能。
用户可以选择开启或关闭数据统计监控功能(您可以设定配置文件中的`enable_stat_monitor`项,详细信息参见[第3.2节](/#/Documents/progress/chap3/sec2))。
用户可以选择开启或关闭数据统计监控功能(您可以设定配置文件中的`enable_stat_monitor`项,详细信息参见[第3.4节](/#/Documents/progress/chap3/sec4))。
#### 写入数据统计
系统目前对写入数据的统计可分为两大模块: 全局(Global) 写入数据统计和存储组(Storage Group) 写入数据统计。 全局统计量记录了所有写入数据的点数、请求数统计,存储组统计量对某一个存储组的写入数据进行了统计,系统默认设定每 5 秒 (若需更改统计频率,您可以设定配置文件中的`back_loop_period_in_second`项,详细信息参见本文[3.2节](/#/Documents/progress/chap3/sec2)) 将统计量写入 IoTDB 中,并以系统指定的命名方式存储。系统刷新或者重启后, IoTDB 不对统计量做恢复处理,统计量从零值重新开始计算。
系统目前对写入数据的统计可分为两大模块: 全局(Global) 写入数据统计和存储组(Storage Group) 写入数据统计。 全局统计量记录了所有写入数据的点数、请求数统计,存储组统计量对某一个存储组的写入数据进行了统计,系统默认设定每 5 秒 (若需更改统计频率,您可以设定配置文件中的`back_loop_period_in_second`项,详细信息参见本文[3.4节](/#/Documents/progress/chap3/sec4)) 将统计量写入 IoTDB 中,并以系统指定的命名方式存储。系统刷新或者重启后, IoTDB 不对统计量做恢复处理,统计量从零值重新开始计算。
为了避免统计信息占用过多空间,我们为统计信息加入定期清除无效数据的机制。系统将每隔一段时间删除无效数据。用户可以通过设置删除机制触发频率(`stat_monitor_retain_interval_in_second`项,默认为600s,详细信息参见本文[4.2节](/#/Documents/progress/chap3/sec2))配置删除数据的频率,通过设置有效数据的期限(`stat_monitor_detect_freq_in_second`项,默认为600s,详细信息参见本文[3.2节](/#/Documents/progress/chap3/sec2))设置有效数据的范围,即距离清除操作触发时间为`stat_monitor_detect_freq_in_second`以内的数据为有效数据。为了保证系统的稳定,不允许频繁地删除统计量,因此如果配置参数的时间小于默认值,系统不采用配置参数而使用默认参数。
为了避免统计信息占用过多空间,我们为统计信息加入定期清除无效数据的机制。系统将每隔一段时间删除无效数据。用户可以通过设置删除机制触发频率(`stat_monitor_retain_interval_in_second`项,默认为600s,详细信息参见本文[3.4节](/#/Documents/progress/chap3/sec4))配置删除数据的频率,通过设置有效数据的期限(`stat_monitor_detect_freq_in_second`项,默认为600s,详细信息参见本文[3.4节](/#/Documents/progress/chap3/sec4))设置有效数据的范围,即距离清除操作触发时间为`stat_monitor_detect_freq_in_second`以内的数据为有效数据。为了保证系统的稳定,不允许频繁地删除统计量,因此如果配置参数的时间小于默认值,系统不采用配置参数而使用默认参数。
注:当前版本统计的写入数据统计信息会同时统计用户写入的数据与系统内部监控数据。
......@@ -77,7 +77,7 @@
|名字| TOTAL\_POINTS\_FAIL |
|:---:|:---|
|描述| 写入点数数百次数|
|描述| 写入点数失败次数|
|时间序列名称| root.stats.write.global.TOTAL\_POINTS\_FAIL |
|服务器重启后是否重置| 是 |
|例子| select TOTAL\_POINTS\_FAIL from root.stats.write.global|
......@@ -92,7 +92,7 @@
|服务器重启后是否重置| 是 |
|例子| select TOTAL\_POINTS\_SUCCESS from root.stats.write.global|
* TOTAL\_REQ\_SUCCESS (STORAGE GROUP)
* TOTAL\_REQ\_SUCCESS (存储组)
|名字| TOTAL\_REQ\_SUCCESS |
|:---:|:---|
......@@ -101,7 +101,7 @@
|服务器重启后是否重置| 是 |
|例子| select TOTAL\_REQ\_SUCCESS from root.stats.write.\<storage\_group\_name\>|
* TOTAL\_REQ\_FAIL (STORAGE GROUP)
* TOTAL\_REQ\_FAIL (存储组)
|名字| TOTAL\_REQ\_FAIL |
|:---:|:---|
......@@ -111,7 +111,7 @@
|例子| select TOTAL\_REQ\_FAIL from root.stats.write.\<storage\_group\_name\>|
* TOTAL\_POINTS\_SUCCESS (STORAGE GROUP)
* TOTAL\_POINTS\_SUCCESS (存储组)
|名字| TOTAL\_POINTS\_SUCCESS |
|:---:|:---|
......@@ -121,7 +121,7 @@
|例子| select TOTAL\_POINTS\_SUCCESS from root.stats.write.\<storage\_group\_name\>|
* TOTAL\_POINTS\_FAIL (STORAGE GROUP)
* TOTAL\_POINTS\_FAIL (存储组)
|名字| TOTAL\_POINTS\_FAIL |
|:---:|:---|
......@@ -150,3 +150,108 @@ select TOTAL_POINTS_SUCCESS from root.stats.write.root_ln
```
select MAX_VALUE(TOTAL_POINTS_SUCCESS) from root.stats.write.root_ln
```
## 性能监控
性能监控模块用来监控IOTDB每一个操作的耗时,以便用户更好的了解数据库的整体性能。此模块会统计每一种操作的平均耗时,以及耗时在一定时间区间内(1ms,4ms,16ms,64ms,256ms,1024ms,以上)的操作的比例。输出文件在log_measure.log中。输出样例如下:
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/60937461-14296f80-a303-11e9-9602-a7bed624bfb3.png">
### 配置参数
配置文件位置:conf/iotdb-engine.properties
<center>**表 -配置参数以及描述项**
|参数|默认值|描述|
|:---|:---|:---|
|enable\_performance\_stat|false|是否开启性能监控模块|
|performance\_stat\_display\_interval|60000|打印统计结果的时间延迟,以毫秒为单位|
|performance_stat_memory_in_kb|20|性能监控模块使用的内存阈值,单位为KB|
</center>
### 利用JMX MBean动态调节参数
通过端口31999连接jconsole,并在上方菜单项中选择‘MBean’. 展开侧边框并选择 'org.apache.iotdb.db.cost.statistic'. 将会得到如下图所示结果:
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/60937484-30c5a780-a303-11e9-8e92-04c413df2088.png">
**属性**
1. EnableStat:是否开启性能监控模块,如果被设置为true,则性能监控模块会记录每个操作的耗时并打印结果。这个参数不能直接通过jconsole直接更改,但可通过下方的函数来进行动态设置。
2. DisplayIntervalInMs:相邻两次打印结果的时间间隔。这个参数可以直接设置,但它要等性能监控模块重启才会生效。重启性能监控模块可以通过先调用 stopStatistic()然后调用startContinuousStatistics()或者直接调用 startOneTimeStatistics()实现。
3. OperationSwitch:这个属性用来展示针对每一种操作是否开启了监控统计,map的键为操作的名字,值为是否针对这种操作开启性能监控。这个参数不能直接通过jconsole直接更改,但可通过下方的 'changeOperationSwitch()'函数来进行动态设置。
**操作**
1. startContinuousStatistics:开启性能监控并以‘DisplayIntervalInMs’的时间间隔打印统计结果。
2. startOneTimeStatistics:开启性能监控并以‘DisplayIntervalInMs’的时间延迟打印一次统计结果。
3. stopStatistic:关闭性能监控。
4. clearStatisticalState(): 清除以统计的结果,从新开始统计。
5. changeOperationSwitch(String operationName, Boolean operationState):设置是否针对每一种不同的操作开启监控。参数‘operationName是操作的名称,在OperationSwitch属性中展示了所有操作的名称。参数 ‘operationState’是操作的状态,打开或者关闭。如果状态设置成功则此函数会返回true,否则返回false。
### 自定义操作类型监控其他区域
**增加操作项**
在org.apache.iotdb.db.cost.statistic.Operation类中增加一个枚举项来表示新增的操作.
**在监控区域增加监控代码**
在监控开始区域增加计时代码:
long t0 = System. currentTimeMillis();
在监控结束区域增加记录代码:
Measurement.INSTANCE.addOperationLatency(Operation, t0);
## cache命中率统计
### 概述
为了提高查询性能,IOTDB对ChunkMetaData和TsFileMetaData进行了缓存。用户可以通过debug级别的日志以及MXBean两种方式来查看缓存的命中率,并根据缓存命中率以及系统内存来调节缓存所使用的内存大小。使用MXBean查看缓存命中率的方法为:
1. 通过端口31999连接jconsole,并在上方菜单项中选择‘MBean’.
2. 展开侧边框并选择 'org.apache.iotdb.db.service'. 将会得到如下图所示结果:
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/65687623-404fc380-e09c-11e9-83c3-3c7c63a5b0be.jpeg">
## 系统日志
IoTDB支持用户通过修改日志配置文件的方式对IoTDB系统日志(如日志输出级别等)进行配置,系统日志配置文件默认位置在$IOTDB_HOME/conf文件夹下,默认的日志配置文件名为logback.xml。用户可以通过增加或更改其中的xml树型节点参数对系统运行日志的相关配置进行修改。详细配置说明参看本文日志文件配置说明。
同时,为了方便在系统运行过程中运维人员对系统的调试,我们为系统运维人员提供了动态修改日志配置的JMX接口,能够在系统不重启的前提下实时对系统的Log模块进行配置。详细使用方法参看动态系统日志配置说明)。
### 动态系统日志配置说明
#### 连接JMX
本节以Jconsole为例介绍连接JMX并进入动态系统日志配置模块的方法。启动Jconsole控制页面,在新建连接处建立与IoTDB Server的JMX连接(可以选择本地进程或给定IoTDB的IP及PORT进行远程连接,IoTDB的JMX服务默认运行端口为31999),如下图使用远程进程连接Localhost下运行在31999端口的IoTDB JMX服务。
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577195-f94d7500-1ef3-11e9-999a-b4f67055d80e.png">
连接到JMX后,您可以通过MBean选项卡找到名为`ch.qos.logback.classic``MBean`,如下图所示。
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577204-fe122900-1ef3-11e9-9e89-2eb1d46e24b8.png">
`ch.qos.logback.classic`的MBean操作(Operations)选项中,可以看到当前动态系统日志配置支持的5种接口,您可以通过使用相应的方法,来执行相应的操作,操作页面如图。
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577216-09fdeb00-1ef4-11e9-9005-542ad7d9e9e0.png">
#### 动态系统日志接口说明
* reloadDefaultConfiguration接口
该方法为重新加载默认的logback配置文件,用户可以先对默认的配置文件进行修改,然后调用该方法将修改后的配置文件重新加载到系统中,使其生效。
* reloadByFileName接口
该方法为加载一个指定路径的logback配置文件,并使其生效。该方法接受一个名为p1的String类型的参数,该参数为需要指定加载的配置文件路径。
* getLoggerEffectiveLevel接口
该方法为获取指定Logger当前生效的日志级别。该方法接受一个名为p1的String类型的参数,该参数为指定Logger的名称。该方法返回指定Logger当前生效的日志级别。
* getLoggerLevel接口
该方法为获取指定Logger的日志级别。该方法接受一个名为p1的String类型的参数,该参数为指定Logger的名称。该方法返回指定Logger的日志级别。
需要注意的是,该方法与`getLoggerEffectiveLevel`方法的区别在于,该方法返回的是指定Logger在配置文件中被设定的日志级别,如果用户没有对该Logger进行日志级别的设定,则返回空。按照Logback的日志级别继承机制,如果一个Logger没有被显示地设定日志级别,其将会从其最近的祖先继承日志级别的设定。这时,调用`getLoggerEffectiveLevel`方法将返回该Logger生效的日志级别;而调用本节所述方法,将返回空。
......@@ -18,7 +18,7 @@
under the License.
-->
# 第10章: 生态集成
# 第7章: 生态集成
<!-- TOC -->
## 概览
......
......@@ -18,7 +18,7 @@
under the License.
-->
# 第10章: 生态集成
# 第7章: 生态集成
# TsFile的Hadoop连接器
<!-- TOC -->
## 概要
......
......@@ -19,6 +19,6 @@
-->
# 第10章: 生态集成
# 第7章: 生态集成
# TsFile的Spark连接器
Coming Soon.
\ No newline at end of file
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# 第7章: 生态集成
Coming Soon.
\ No newline at end of file
......@@ -19,10 +19,9 @@
-->
# 第5章 系统管理
# 第8章: 系统设计
## 数据管理
## 文件
本节将介绍IoTDB的数据存储方式,便于您对IoTDB的数据管理有一个直观的了解。
......
......@@ -18,57 +18,55 @@
under the License.
-->
# Chapter 0: QuickStart
# Chapter 0: Get Started
* 1-QuickStart
* 2-Frequently asked questions
* 3-Reference
* 3-Publication
# Chapter 1: Overview
* 1-What is IoTDB
* 2-Architecture
* 3-Scenario
* 4-Features
# Chapter 2: Concept
* 1-Key Concepts and Terminology
* 2-Data Type
* 3-Encoding
* 4-Compression
# Chapter 3: Deployment
* 1-Deployment
* 2-Configuration
* 3-Build and use IoTDB by Dockerfile
* 4-TsFile library Intallation
# Chapter 4: Operation Manual
* 1-Cli Shell Tool
* 2-Data Model Selection
* 3-Data Import
* 4-Data Query
* 5-Data Maintenance
* 6-Priviledge Management
* 7-IoTDB Query Language
* 8-TsFile Usage
# Chapter 5: Management
* 1-System Monitor
* 2-Performance Monitor
* 3-System log
* 4-Data Management
# Chapter 6: API
* 1-JDBC API
* 2-Session API
* 3-Python API
# Chapter 7: System Design
* 1-Hierarchy
# Chapter 8: Distributed Architecture
* 1-Shared Storage Architecture
* 2-Shared Nothing Architecture
# Chapter 9: System Tools
* 1-Data Modal and Terminology
* 2-Data Type
* 3-Encoding
* 4-Compression
# Chapter 3: Server
* 1-Download
* 2-Single Node Setup
* 3-Cluster Setup
* 4-Config Manual
* 5-Docker Image
# Chapter 4: Client
* 1-Command Line Interface(CLI)
* 2-Programming - JDBC
* 3-Programming - Session
* 4-Programming - Other Language
* 5-Programming - TsFile API (TimeSeries File Format)
# Chapter 5: Operation Manual
* 1-DDL (Data Definition Language)
* 2-DML (Data Manipulation Languange)
* 3-Account Management Statements
* 4-SQL Reference
# Chapter 6: System Tools
* 1-Sync Tool
* 2-Memory Estimation Tool
* 3-JMX Tool
* 4-Watermark Tool
* 5-Log Visualizer
* 6-Query History Visualization Tool
# Chapter 10: Ecosystem Integration
* 7-Monitor and Log Tools
# Chapter 7: Ecosystem Integration
* 1-Grafana
* 2-TsFile Hadoop Connector
* 3-TsFile Spark Connector
* 4-Spark IoTDB Connector
\ No newline at end of file
* 4-Spark IoTDB Connector
* 5-Tsfile Hive Connector
# Chapter 8: System Design (Developer)
* 1-Hierarchy
* 2-Files
* 3-Writing Data on HDFS
* 4-Shared Nothing Cluster
......@@ -48,8 +48,7 @@ This short guide will walk you through the basic process of using IoTDB. For a m
To use IoTDB, you need to have:
1. Java >= 1.8 (Please make sure the environment path has been set)
2. Maven >= 3.1 (If you want to compile and install IoTDB from source code)
3. Set the max open files num as 65535 to avoid "too many open files" problem.
2. Set the max open files num as 65535 to avoid "too many open files" problem.
## Installation
......@@ -60,27 +59,14 @@ IoTDB provides you three installation methods, you can refer to the following su
* Using Docker:The path to the dockerfile is https://github.com/apache/incubator-iotdb/blob/master/docker/Dockerfile
Here in the Quick Start, we give a brief introduction of using source code to install IoTDB. For further information, please refer to Chapter 4 of the User Guide.
Here in the Quick Start, we give a brief introduction to install IoTDB. For further information, please refer to Chapter 3 of the User Guide.
## Build from source
## Download
You can download the source code from:
You can download the binary file from:
[Here](https://iotdb.apache.org/#/Download)
```
git clone https://github.com/apache/incubator-iotdb.git
```
Under the root path of incubator-iotdb:
```
> mvn clean package -DskipTests
```
Then the binary version (including both server and client) can be found at **distribution/target/apache-iotdb-{project.version}-incubating-bin.zip**
> NOTE: Directories "service-rpc/target/generated-sources/thrift" and "server/target/generated-sources/antlr3" need to be added to sources roots to avoid compilation errors in IDE.
### Configurations
## Configurations
configuration files are under "conf" folder
......@@ -88,7 +74,7 @@ configuration files are under "conf" folder
* system config module (`tsfile-format.properties`, `iotdb-engine.properties`)
* log config module (`logback.xml`).
For more, see [Chapter3: Deployment](https://iotdb.apache.org/#/Documents/progress/chap3/sec1) in detail.
For more, see [Chapter3: Server](https://iotdb.apache.org/#/Documents/progress/chap3/sec1) in detail.
## Start
......@@ -239,7 +225,7 @@ or
IoTDB> exit
```
For more on what commands are supported by IoTDB SQL, see [IoTDB SQL Language](https://iotdb.apache.org/#/Documents/progress/chap4/sec7).
For more on what commands are supported by IoTDB SQL, see [SQL Reference](https://iotdb.apache.org/#/Documents/progress/chap5/sec4).
### Stop IoTDB
......@@ -253,16 +239,6 @@ The server can be stopped with ctrl-C or the following script:
> sbin\stop-server.bat
```
## Only build server
Under the root path of incubator-iotdb:
```
> mvn clean package -pl server -am -DskipTests
```
After build, the IoTDB server will be at the folder "server/target/iotdb-server-{project.version}".
## Only build client
......
......@@ -113,7 +113,7 @@ Yes. IoTDB has intense integration with Open Source Ecosystem. IoTDB supports [H
## How does IoTDB handle duplicate points?
A data point is uniquely identified by a full time series path (e.g. ```root.vehicle.d0.s0```) and timestamp. If you submit a new point with the same path and timestamp as an existing point,
A data point is uniquely identified by a full time series path (e.g. ```root.vehicle.d0.s0```) and timestamp. If you submit a new point with the same path and timestamp as an existing point, IoTDB will update the value of this point instead of inserting a new point.
## How can I tell what type of the specific timeseries?
......
......@@ -27,7 +27,7 @@ Besides IoTDB engine, we also developed several components to provide better IoT
IoTDB suite can provide a series of functions in the real situation such as data collection, data writing, data storage, data query, data visualization and data analysis. Figure 1.1 shows the overall application architecture brought by all the components of the IoTDB suite.
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51578977-4d5b5800-1efa-11e9-9d6e-6bfe7e890f30.jpg">
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/25913899/67943956-39c1e800-fc16-11e9-8da2-a662f8246816.png">
As shown in Figure 1.1, users can use JDBC to import timeseries data collected by sensor on the device to local/remote IoTDB. These timeseries data may be system state data (such as server load and CPU memory, etc.), message queue data, timeseries data from applications, or other timeseries data in the database. Users can also write the data directly to the TsFile (local or on HDFS).
......
......@@ -20,9 +20,20 @@
-->
# Chapter 2: Concept
## Key Concepts and Terminology
## Data Model and Terminology
To make this manual more practical, we will use a specific scenario example to illustrate how to operate IoTDB databases at all stages of use. See [this page](https://github.com/apache/incubator-iotdb/blob/master/docs/Documentation/OtherMaterial-Sample%20Data.txt) for a look. For convenience, we also provide you with a sample data file in real scenario to import into the IoTDB system for trial and operation.
The following basic concepts are involved in IoTDB:
Download file: [IoTDB-SampleData.txt](https://raw.githubusercontent.com/apache/incubator-iotdb/master/docs/Documentation/OtherMaterial-Sample%20Data.txt).
According to the data attribute layers described in [sample data](https://raw.githubusercontent.com/apache/incubator-iotdb/master/docs/Documentation/OtherMaterial-Sample%20Data.txt), we can express it as an attribute hierarchy structure based on the coverage of attributes and the subordinate relationship between them, as shown in Figure 2.1 below. Its hierarchical relationship is: power group layer - power plant layer - device layer - sensor layer. ROOT is the root node, and each node of sensor layer is called a leaf node. In the process of using IoTDB, you can directly connect the attributes on the path from ROOT node to each leaf node with ".", thus forming the name of a timeseries in IoTDB. For example, The left-most path in Figure 2.1 can generate a timeseries named `ROOT.ln.wf01.wt01.status`.
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577327-7aa50780-1ef4-11e9-9d75-cadabb62444e.jpg">
**Figure 2.1 Attribute hierarchy structure**</center>
After getting the name of the timeseries, we need to set up the storage group according to the actual scenario and scale of the data. Because in the scenario of this chapter data is usually arrived in the unit of groups (i.e., data may be across electric fields and devices), in order to avoid frequent switching of IO when writing data, and to meet the user's requirement of physical isolation of data in the unit of groups, we set the storage group at the group layer.
Here are the basic concepts of the model involved in IoTDB:
* Device
......@@ -208,14 +219,3 @@ Relative time refers to the time relative to the server time ```now()``` and ```
```
> Note:There must be spaces on the left and right of '+' and '-'.
* Value
The value of a time series is actually the value sent by a sensor to IoTDB. This value can be stored by IoTDB according to the data type. At the same time, users can select the compression mode and the corresponding encoding mode according to the data type of this value. See [Data Type](/#/Documents/progress/chap2/sec2), [Encoding](/#/Documents/progress/chap2/sec3) and [Compression](/#/Documents/progress/chap2/sec4) of this document for details on data type and corresponding encoding.
* Point
A data point is made up of a timestamp value pair (timestamp, value).
* Column
A column of data contains all values belonging to a time series and the timestamps corresponding to these values. When there are multiple columns of data, IoTDB merges the timestamps into multiple < timestamp-value > pairs (timestamp, value, value,...).
......@@ -31,7 +31,7 @@ IoTDB supports six data types in total:
* TEXT (String).
The time series of **FLOAT** and **DOUBLE** type can specify (MAX\_POINT\_NUMBER, see [this page](/#/Documents/progress/chap4/sec7) for more information on how to specify), which is the number of digits after the decimal point of the floating point number, if the encoding method is [RLE](/#/Documents/progress/chap2/sec3) or [TS\_2DIFF](/#/Documents/progress/chap2/sec3) (Refer to [Create Timeseries Statement](/#/Documents/progress/chap5/sec1) for more information on how to specify). If MAX\_POINT\_NUMBER is not specified, the system will use [float\_precision](/#/Documents/progress/chap4/sec2) in the configuration file `tsfile-format.properties`.
The time series of **FLOAT** and **DOUBLE** type can specify (MAX\_POINT\_NUMBER, see [this page](/#/Documents/progress/chap5/sec4) for more information on how to specify), which is the number of digits after the decimal point of the floating point number, if the encoding method is [RLE](/#/Documents/progress/chap2/sec3) or [TS\_2DIFF](/#/Documents/progress/chap2/sec3) (Refer to [Create Timeseries Statement](/#/Documents/progress/chap5/sec4) for more information on how to specify). If MAX\_POINT\_NUMBER is not specified, the system will use [float\_precision](/#/Documents/progress/chap3/sec4) in the configuration file `tsfile-format.properties`.
* For Float data value, The data range is (-Integer.MAX_VALUE, Integer.MAX_VALUE), rather than Float.MAX_VALUE, and the max_point_number is 19, it is because of the limition of function Math.round(float) in Java.
* For Double data value, The data range is (-Long.MAX_VALUE, Long.MAX_VALUE), rather than Double.MAX_VALUE, and the max_point_number is 19, it is because of the limition of function Math.round(double) in Java (Long.MAX_VALUE=9.22E18).
......
......@@ -32,13 +32,13 @@ PLAIN encoding, the default encoding mode, i.e, no encoding, supports multiple d
Second-order differential encoding is more suitable for encoding monotonically increasing or decreasing sequence data, and is not recommended for sequence data with large fluctuations.
Second-order differential encoding can also be used to encode floating-point numbers, but it is necessary to specify reserved decimal digits (MAX\_POINT\_NUMBER, see [this page](/#/Documents/progress/chap5/sec1) for more information on how to specify) when creating time series. It is more suitable for storing sequence data where floating-point values appear continuously, monotonously increase or decrease, and it is not suitable for storing sequence data with high precision requirements after the decimal point or with large fluctuations.
Second-order differential encoding can also be used to encode floating-point numbers, but it is necessary to specify reserved decimal digits (MAX\_POINT\_NUMBER, see [this page](/#/Documents/progress/chap5/sec4) for more information on how to specify) when creating time series. It is more suitable for storing sequence data where floating-point values appear continuously, monotonously increase or decrease, and it is not suitable for storing sequence data with high precision requirements after the decimal point or with large fluctuations.
* RLE
Run-length encoding is more suitable for storing sequence with continuous integer values, and is not recommended for sequence data with most of the time different values.
Run-length encoding can also be used to encode floating-point numbers, but it is necessary to specify reserved decimal digits (MAX\_POINT\_NUMBER, see [this page](/#/Documents/progress/chap4/sec7) for more information on how to specify) when creating time series. It is more suitable for storing sequence data where floating-point values appear continuously, monotonously increasing or decreasing, and it is not suitable for storing sequence data with high precision requirements after the decimal point or with large fluctuations.
Run-length encoding can also be used to encode floating-point numbers, but it is necessary to specify reserved decimal digits (MAX\_POINT\_NUMBER, see [this page](/#/Documents/progress/chap5/sec4) for more information on how to specify) when creating time series. It is more suitable for storing sequence data where floating-point values appear continuously, monotonously increasing or decreasing, and it is not suitable for storing sequence data with high precision requirements after the decimal point or with large fluctuations.
* GORILLA
......
......@@ -25,4 +25,10 @@
When the time series is written and encoded as binary data according to the specified type, IoTDB compresses the data using compression technology to further improve space storage efficiency. Although both encoding and compression are designed to improve storage efficiency, encoding techniques are usually only available for specific data types (e.g., second-order differential encoding is only suitable for INT32 or INT64 data type, and storing floating-point numbers requires multiplying them by 10m to convert to integers), after which the data is converted to a binary stream. The compression method (SNAPPY) compresses the binary stream, so the use of the compression method is no longer limited by the data type.
IoTDB allows you to specify the compression method of the column when creating a time series. IoTDB now supports several kinds of compression: UNCOMPRESSED (no compression), SNAPPY, GZIP, LZ0, SDT, PAA and PLA. The specified syntax for compression is detailed in [Create Timeseries Statement](/#/Documents/progress/chap4/sec7).
\ No newline at end of file
IoTDB allows you to specify the compression method of the column when creating a time series, and now supports two compression methods:
* UMCOMPRESSED
* SNAPPY
The specified syntax for compression is detailed in [Create Timeseries Statement](/#/Documents/progress/chap5/sec4).
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 3: Deployment
## Installation
IoTDB provides you two installation methods, you can refer to the following suggestions, choose one of them:
* Installation from binary files. Download the binary files from the official website. This is the recommended method, in which you will get a binary released package which is out-of-the-box.
* Installation from source code. If you need to modify the code yourself, you can use this method.
### Prerequisites
To install and use IoTDB, you need to have:
1. Java >= 1.8 (Please make sure the environment path has been set)
2. Maven >= 3.1 (If you want to compile and install IoTDB from source code)
3. TsFile >= 0.7.0 (TsFile Github page: [https://github.com/thulab/tsfile](https://github.com/thulab/tsfile))
4. IoTDB-JDBC >= 0.7.0 (IoTDB-JDBC Github page: [https://github.com/thulab/iotdb-jdbc](https://github.com/thulab/iotdb-jdbc))
TODO: TsFile and IoTDB-JDBC dependencies will be removed after the project reconstruct.
### Installation from binary files
IoTDB provides you binary files which contains all the necessary components for the IoTDB system to run. You can get them on our website [http://tsfile.org/download](http://tsfile.org/download).
```
NOTE:
iotdb-<version>.tar.gz # For Linux or MacOS
iotdb-<version>.zip # For Windows
```
After downloading, you can extract the IoTDB tarball using the following operations:
```
Shell > uzip iotdb-<version>.zip # For Windows
Shell > tar -zxf iotdb-<version>.tar.gz # For Linux or MacOS
```
The IoTDB project will be at the subfolder named iotdb. The folder will include the following contents:
```
iotdb/ <-- root path
|
+- sbin/ <-- script files
|
+- conf/ <-- configuration files
|
+- lib/ <-- project dependencies
|
+- LICENSE <-- LICENSE
```
### Installation from source code
You can get the released source code from https://iotdb.apache.org/#/Download, or from the git repository https://github.com/apache/incubator-iotdb/tree/master
Now suppose your directory is like this:
```
> pwd
/workspace/incubator-iotdb
> ls -l
incubator-iotdb/ <-- root path
|
+- server/
|
+- jdbc/
|
+- client/
|
...
|
+- pom.xml
```
Let `$IOTDB_HOME = /workspace/incubator-iotdb/server/target/iotdb-server-{project.version}`
Let `$IOTDB_CLI_HOME = /workspace/incubator-iotdb/client/target/iotdb-client-{project.version}`
Note:
* if `IOTDB_HOME` is not explicitly assigned,
then by default `IOTDB_HOME` is the direct parent directory of `sbin/start-server.sh` on Unix/OS X
(or that of `sbin\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 `sbin/start-cli.sh` on
Unix/OS X (or that of `sbin\start-cli.bat` on Windows).
If you are not the first time that building IoTDB, remember deleting the following files:
```
> rm -rf $IOTDB_HOME/data/
> rm -rf $IOTDB_HOME/lib/
```
Then under the root path of incubator-iotdb, you can build IoTDB using Maven:
```
> pwd
/workspace/incubator-iotdb
> mvn clean package -pl server -am -Dmaven.test.skip=true
```
If successful, you will see the the following text in the terminal:
```
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache IoTDB (incubating) Project Parent POM ....... SUCCESS [ 6.405 s]
[INFO] TsFile ............................................. SUCCESS [ 10.435 s]
[INFO] Service-rpc ........................................ SUCCESS [ 4.170 s]
[INFO] IoTDB Jdbc ......................................... SUCCESS [ 3.252 s]
[INFO] IoTDB Server ....................................... SUCCESS [ 8.072 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
```
Otherwise, you may need to check the error statements and fix the problems.
After building, the IoTDB project will be at the subfolder named iotdb. The folder will include the following contents:
```
$IOTDB_HOME/
|
+- sbin/ <-- script files
|
+- conf/ <-- configuration files
|
+- lib/ <-- project dependencies
```
<!-- > 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](/#/Documents/progress/chap3/sec3)
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 3: Deployment
## TsFile libaray Installation
TsFile is an important dependency of IoTDB. It is necessary to install TsFile for using IoTDB.
Before started, maven should be installed. See <a href="https://maven.apache.org/install.html">How to install maven</a>
There are two ways to use TsFile in your own project.
* Using as jars:
* Compile the source codes and build to jars
```
git clone https://github.com/apache/incubator-iotdb.git
cd tsfile/
mvn clean package -Dmaven.test.skip=true
```
Then, all the jars can be get in folder named `target/`. Import `target/tsfile-0.9.0-SNAPSHOT-jar-with-dependencies.jar` to your project.
* Using as a maven dependency:
Compile source codes and deploy to your local repository in three steps:
* Get the source codes
```
git clone https://github.com/apache/incubator-iotdb.git
```
* Compile the source codes and deploy
```
cd tsfile/
mvn clean install -Dmaven.test.skip=true
```
* add dependencies into your project:
```
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>tsfile</artifactId>
<version>0.9.0-SNAPSHOT</version>
</dependency>
```
Or, you can download the dependencies from official Maven repository:
* First, find your maven `settings.xml` on path: `${username}\.m2\settings.xml`
, add this `<profile>` to `<profiles>`:
```
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>apache.snapshots</id>
<name>Apache Development Snapshot Repository</name>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
```
* Then add dependencies into your project:
```
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>tsfile</artifactId>
<version>0.9.0-SNAPSHOT</version>
</dependency>
```
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 3: Server
## Download
IoTDB provides you three installation methods, you can refer to the following suggestions, choose one of them:
* Installation from source code. If you need to modify the code yourself, you can use this method.
* Installation from binary files. Download the binary files from the official website. This is the recommended method, in which you will get a binary released package which is out-of-the-box.(Comming Soon...)
* Using Docker:The path to the dockerfile is https://github.com/apache/incubator-iotdb/blob/master/docker/Dockerfile
### Prerequisites
To use IoTDB, you need to have:
1. Java >= 1.8 (Please make sure the environment path has been set)
2. Maven >= 3.1 (Optional)
3. Set the max open files num as 65535 to avoid "too many open files" problem.
>Note: If you don't have maven installed, you should replace 'mvn' in the following commands with 'mvnw.sh' or 'mvnw.cmd'.
### Installation from binary files
You can download the binary file from:
[Here](https://iotdb.apache.org/#/Download)
### Installation from source code
You can get the released source code from https://iotdb.apache.org/#/Download, or from the git repository https://github.com/apache/incubator-iotdb/tree/master
You can download the source code from:
```
git clone https://github.com/apache/incubator-iotdb.git
```
Under the root path of incubator-iotdb:
```
> mvn clean package -DskipTests
```
Then the binary version (including both server and client) can be found at **distribution/target/apache-iotdb-{project.version}-incubating-bin.zip**
> NOTE: Directories "service-rpc/target/generated-sources/thrift" and "server/target/generated-sources/antlr3" need to be added to sources roots to avoid compilation errors in IDE.
If you would like to build the IoTDB server, you can run the following command under the root path of incubator-iotdb:
```
> mvn clean package -pl server -am -DskipTests
```
After build, the IoTDB server will be at the folder "server/target/iotdb-server-{project.version}".
### Installation by Docker (Dockerfile)
You can build and run a IoTDB docker image by following the guide of [Deployment by Docker](/#/Documents/progress/chap3/sec5)
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 3: Server
## Single Node Setup
Users can start IoTDB by the start-server script under the sbin folder.
```
# Unix/OS X
> sbin/start-server.sh
# Windows
> sbin\start-server.bat
```
\ No newline at end of file
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 3: Server
## Cluster Setup
Comming soon...
......@@ -19,16 +19,16 @@
-->
# Chapter 3: Deployment and Management
# Chapter 3: Server
## Configuration
## Config Manual
Before starting to use IoTDB, you need to config the configuration files first. For your convenience, we have already set the default config in the files.
In total, we provide users three kinds of configurations module:
* environment configuration file (`iotdb-env.bat`, `iotdb-env.sh`). The default configuration file for the environment configuration item. Users can configure the relevant system configuration items of JAVA-JVM and set environment variable in the file.
* environment configuration file (`iotdb-env.bat`, `iotdb-env.sh`). The default configuration file for the environment configuration item. Users can configure the relevant system configuration items of JAVA-JVM in the file.
* system configuration file (`tsfile-format.properties`, `iotdb-engine.properties`).
* `tsfile-format.properties`: The default configuration file for the IoTDB file layer configuration item. Users can configure the information about the TsFile, such as the data size written to the disk per time(`group_size_in_byte`).
* `iotdb-engine.properties`: The default configuration file for the IoTDB engine layer configuration item. Users can configure the IoTDB engine related parameters in the file, such as JDBC service listening port (`rpc_port`), unsequence data storage directory (`unsequence_data_dir`), etc.
......
......@@ -19,9 +19,9 @@
-->
# Chapter 3: Deployment
# Chapter 3: Server
## Build and use IoTDB by Dockerfile
## Docker Image
Now a Dockerfile has been written at ROOT/docker/Dockerfile on the branch enable_docker_image.
1. You can build a docker image by:
......
......@@ -18,21 +18,30 @@
under the License.
-->
<!-- TOC -->
# Chapter 4: Operation Manual
# Chapter 4: Client
## Outline
- Cli/shell tool
<!-- TOC -->
- CCommand Line Interface(CLI)
- Running Cli/Shell
- Cli/Shell Parameters
- Cli/shell tool with -e parameter
<!-- /TOC -->
# Cli/shell tool
# Command Line Interface(CLI)
IoTDB provides Cli/shell tools for users to interact with IoTDB server in command lines. This document will show how Cli/shell tool works and what does it parameters mean.
> Note: In this document, \$IOTDB\_HOME represents the path of the IoTDB installation directory.
## Build client from source code
Under the root path of incubator-iotdb:
```
> mvn clean package -pl client -am -DskipTests
```
After build, the IoTDB client will be at the folder "client/target/iotdb-client-{project.version}".
## Running Cli/Shell
After installation, there is a default user in IoTDB: `root`, and the
......
......@@ -19,8 +19,8 @@
-->
# Chapter6: API
# JDBC API
# Chapter4: Client
# Programming - JDBC
## Usage
......
......@@ -19,8 +19,8 @@
-->
# Chapter6: API
# Session API
# Chapter 4: Client
# Programming - Session
## Usage
### Dependencies
......
......@@ -18,14 +18,15 @@
under the License.
-->
# Chapter6: API
# Chapter 4: Client
# Python API
# Introduction
# Programming - Other Language
## Python API
### Introduction
This is an example of how to connect to IoTDB with python, using the thrift rpc interfaces. Things will be a bit different
on Linux or Windows, we will introduce how to operate on the two systems separately.
## Prerequisites
### Prerequisites
python3.7 or later is preferred.
You have to install Thrift (0.11.0 or later) to compile our thrift file into python code. Below is the official
......@@ -34,11 +35,11 @@ tutorial of installation:
http://thrift.apache.org/docs/install/
```
## Compile
### Compile
If you have added Thrift executable into your path, you may just run `compile.sh` or `compile.bat`, or you will have to
modify it to set variable `THRIFT_EXE` to point to your executable. This will generate thrift sources under folder `target`,
you can add it to your `PYTHONPATH` so that you would be able to use the library in your code.
## Example
### Example
We provided an example of how to use the thrift library to connect to IoTDB in `src\client_example.py`, please read it
carefully before you write your own code.
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 4: Operation Manual
## Data Import
### Import Historical Data
This feature is not supported in version 0.7.0.
### Import Real-time Data
IoTDB provides users with a variety of ways to insert real-time data, such as directly inputting [INSERT SQL statement](/#/Documents/progress/chap4/sec7) in [Client/Shell tools](/#/Tools/Client), or using [Java JDBC](/#/Documents/progress/chap4/sec7) to perform single or batch execution of [INSERT SQL statement](/#/Documents/progress/chap4/sec7).
This section mainly introduces the use of [INSERT SQL statement](/#/Documents/progress/chap4/sec7) for real-time data import in the scenario. See Section 4.7 for a detailed syntax of [INSERT SQL statement](/#/Documents/progress/chap4/sec7).
#### Use of INSERT Statements
The [INSERT SQL statement](/#/Documents/progress/chap4/sec7) statement can be used to insert data into one or more specified timeseries that have been created. For each point of data inserted, it consists of a [timestamp](/#/Documents/progress/chap2/sec1) and a sensor acquisition value of a numerical type (see [Data Type](/#/Documents/progress/chap2/sec2)).
In the scenario of this section, take two timeseries `root.ln.wf02.wt02.status` and `root.ln.wf02.wt02.hardware` as an example, and their data types are BOOLEAN and TEXT, respectively.
The sample code for single column data insertion is as follows:
```
IoTDB > insert into root.ln.wf02.wt02(timestamp,status) values(1,true)
IoTDB > insert into root.ln.wf02.wt02(timestamp,hardware) values(1, "v1")
```
The above example code inserts the long integer timestamp and the value "true" into the timeseries `root.ln.wf02.wt02.status` and inserts the long integer timestamp and the value "v1" into the timeseries `root.ln.wf02.wt02.hardware`. When the execution is successful, cost time is shown to indicate that the data insertion has been completed.
> Note: In IoTDB, TEXT type data can be represented by single and double quotation marks. The insertion statement above uses double quotation marks for TEXT type data. The following example will use single quotation marks for TEXT type data.
The INSERT statement can also support the insertion of multi-column data at the same time point. The sample code of inserting the values of the two timeseries at the same time point '2' is as follows:
```
IoTDB > insert into root.ln.wf02.wt02(timestamp, status, hardware) VALUES (2, false, 'v2')
```
After inserting the data, we can simply query the inserted data using the SELECT statement:
```
IoTDB > select * from root.ln.wf02 where time < 3
```
The result is shown below. From the query results, it can be seen that the insertion statements of single column and multi column data are performed correctly.
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51605021-c2ee1500-1f48-11e9-8f6b-ba9b48875a41.png"></center>
### Error Handling of INSERT Statements
If the user inserts data into a non-existent timeseries, for example, execute the following commands:
```
IoTDB > insert into root.ln.wf02.wt02(timestamp, temperature) values(1,"v1")
```
Because `root.ln.wf02.wt02. temperature` does not exist, the system will return the following ERROR information:
```
Msg: Current deviceId[root.ln.wf02.wt02] does not contains measurement:temperature
```
If the data type inserted by the user is inconsistent with the corresponding data type of the timeseries, for example, execute the following command:
```
IoTDB > insert into root.ln.wf02.wt02(timestamp,hardware) values(1,100)
```
The system will return the following ERROR information:
```
error: The TEXT data type should be covered by " or '
```
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 4: Operation Manual
## Data Maintenance
<!-- >
### Data Update
Users can use [UPDATE statements](/#/Documents/0.8.0/chap5/sec1) to update data over a period of time in a specified timeseries. When updating data, users can select a timeseries to be updated (version 0.8.0 does not support multiple timeseries updates) and specify a time point or period to be updated (version 0.8.0 must have time filtering conditions).
In a JAVA programming environment, you can use the [Java JDBC](/#/Documents/0.8.0/chap6/sec1) to execute single or batch UPDATE statements.
#### Update Single Timeseries
Taking the power supply status of ln group wf02 plant wt02 device as an example, there exists such a usage scenario:
After data access and analysis, it is found that the power supply status from 2017-11-01 15:54:00 to 2017-11-01 16:00:00 is true, but the actual power supply status is abnormal. You need to update the status to false during this period. The SQL statement for this operation is:
```
update root.ln.wf02 SET wt02.status = false where time <=2017-11-01T16:00:00 and time >= 2017-11-01T15:54:00
```
It should be noted that when the updated data type does not match the actual data type, IoTDB will give the corresponding error prompt as shown below:
```
IoTDB> update root.ln.wf02 set wt02.status = 1205 where time < now()
error: The BOOLEAN data type should be true/TRUE or false/FALSE
```
When the updated path does not exist, IoTDB will give the corresponding error prompt as shown below:
```
IoTDB> update root.ln.wf02 set wt02.sta = false where time < now()
Msg: do not select any existing series
```
-->
### Data Deletion
Users can delete data that meet the deletion condition in the specified timeseries by using the [DELETE statement](/#/Documents/progress/chap4/sec7). When deleting data, users can select one or more timeseries paths, prefix paths, or paths with star to delete data before a certain time (version 0.8.0 does not support the deletion of data within a closed time interval).
In a JAVA programming environment, you can use the [Java JDBC](/#/Documents/progress/chap6/sec1) to execute single or batch UPDATE statements.
#### Delete Single Timeseries
Taking ln Group as an example, there exists such a usage scenario:
The wf02 plant's wt02 device has many segments of errors in its power supply status before 2017-11-01 16:26:00, and the data cannot be analyzed correctly. The erroneous data affected the correlation analysis with other devices. At this point, the data before this time point needs to be deleted. The SQL statement for this operation is
```
delete from root.ln.wf02.wt02.status where time<=2017-11-01T16:26:00;
```
#### Delete Multiple Timeseries
When both the power supply status and hardware version of the ln group wf02 plant wt02 device before 2017-11-01 16:26:00 need to be deleted, [the prefix path with broader meaning or the path with star](/#/Documents/progress/chap2/sec1) can be used to delete the data. The SQL statement for this operation is:
```
delete from root.ln.wf02.wt02 where time <= 2017-11-01T16:26:00;
```
or
```
delete from root.ln.wf02.wt02.* where time <= 2017-11-01T16:26:00;
```
It should be noted that when the deleted path does not exist, IoTDB will give the corresponding error prompt as shown below:
```
IoTDB> delete from root.ln.wf03.wt02.status where time < now()
Msg: TimeSeries does not exist and its data cannot be deleted
```
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 5: Management
## Performance Monitor
### Introduction
In order to grasp the performance of iotdb, we add this module to count the time-consuming of each operation. This module can statistic the avg time-consuming of each operation and the proportion of each operation fall into a time range. The output is in log_measure.log file. A output example is in below.  
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/60937461-14296f80-a303-11e9-9602-a7bed624bfb3.png">
### Configuration parameter
location:conf/iotdb-engine.properties
<center>**Table -parameter and description**
|Parameter|Default Value|Description|
|:---|:---|:---|
|enable\_performance\_stat|false|Is stat performance of sub-module enable.|
|performance\_stat\_display\_interval|60000|The interval of display statistic result in ms.|
|performance_stat_memory_in_kb|20|The memory used for performance_stat in kb.|
</center>
### JMX MBean
Connect to jconsole with port 31999,and choose ‘MBean’in menu bar. Expand the sidebar and choose 'org.apache.iotdb.db.cost.statistic'. You can Find:
<img style="width:100%; max-width:600px; max-height:200px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/60937484-30c5a780-a303-11e9-8e92-04c413df2088.png">
**Attribute**
1. EnableStat:Whether the statistics are enable or not, if it is true, the module records the time-consuming of each operation and prints the results; It can not be set dynamically but changed by function in below.
2. DisplayIntervalInMs:The interval between print results. It can be set dynamically, but will take effect after restart.( First call stopStatistic(), then call startContinuousStatistics() or startOneTimeStatistics())
3. OperationSwitch:It's a map to indicate whether stat the operation, the key is operation name and the value is stat state. This parameter cannot be changed directly, it's change by operation 'changeOperationSwitch()'.
**Operation**
1. startContinuousStatistics: Start the statistics and output at interval of ‘DisplayIntervalInMs’.
2. startOneTimeStatistics:Start the statistics and output in delay of ‘DisplayIntervalInMs’.
3. stopStatistic:Stop the statistics.
4. clearStatisticalState(): clear current stat result, reset statistical result.
5. changeOperationSwitch(String operationName, Boolean operationState):set whether to monitor operation status. The param 'operationName' is the name of operation, defined in attribute operationSwitch. The param operationState is the state of operation. If state-switch successful the function will return true, else return false.
### Adding Custom Monitoring Items for developer of IOTDB
**Add Operation**
Add an enumeration in org.apache.iotdb.db.cost.statistic.Operation.
**Add Timing Code in Monitoring Area**
Add timing code in the monitoring start area:
long t0 = System. currentTimeMillis();
Add timing code in the monitoring stop area:
Measurement.INSTANCE.addOperationLatency(Operation, t0);
## Cache Hit Ratio Statistics
### Overview
To improve query performance, IOTDB caches ChunkMetaData and TsFileMetaData. Users can view the cache hit rate through debug level log and MXBean, and adjust the memory occupied by the cache according to the cache hit rate and system memory. The method of using MXBean to view cache hit ratio is as follows:
1. Connect to jconsole with port 31999 and select 'MBean' in the menu item above.
2. Expand the sidebar and select 'org.apache.iotdb.db.service'. You will get the results shown in the following figure:
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/65687623-404fc380-e09c-11e9-83c3-3c7c63a5b0be.jpeg">
\ No newline at end of file
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
# Chapter 5: Management
## System log
IoTDB allows users to configure IoTDB system logs (such as log output level) by modifying the log configuration file. The default location of the system log configuration file is in \$IOTDB_HOME/conf folder.
The default log configuration file is named logback.xml. The user can modify the configuration of the system running log by adding or changing the xml tree node parameters. It should be noted that the configuration of the system log using the log configuration file does not take effect immediately after the modification, instead, it will take effect after restarting the system. The usage of logback.xml is just as usual.
At the same time, in order to facilitate the debugging of the system by the developers and DBAs, we provide several JMX interface to dynamically modify the log configuration, and configure the Log module of the system in real time without restarting the system. For detailed usage, see [Dynamic System Log Configuration](/#/Documents/progress/chap5/sec4) section.
### Dynamic System Log Configuration
#### Connect JMX
Here we use JConsole to connect with JMX.
Start the JConsole, establish a new JMX connection with the IoTDB Server (you can select the local process or input the IP and PORT for remote connection, the default operation port of the IoTDB JMX service is 31999). Fig 4.1 shows the connection GUI of JConsole.
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577195-f94d7500-1ef3-11e9-999a-b4f67055d80e.png">
After connected, click `MBean` and find `ch.qos.logback.classic.default.ch.qos.logback.classic.jmx.JMXConfigurator`(As shown in fig 4.2).
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577204-fe122900-1ef3-11e9-9e89-2eb1d46e24b8.png">
In the JMXConfigurator Window, there are 6 operation provided for you, as shown in fig 4.3. You can use there interface to perform operation.
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577216-09fdeb00-1ef4-11e9-9005-542ad7d9e9e0.png">
#### Interface Instruction
* reloadDefaultConfiguration
This method is to reload the default logback configuration file. The user can modify the default configuration file first, and then call this method to reload the modified configuration file into the system to take effect.
* reloadByFileName
This method loads a logback configuration file with the specified path and name, and then makes it take effect. This method accepts a parameter of type String named p1, which is the path to the configuration file that needs to be specified for loading.
* getLoggerEffectiveLevel
This method is to obtain the current log level of the specified Logger. This method accepts a String type parameter named p1, which is the name of the specified Logger. This method returns the log level currently in effect for the specified Logger.
* getLoggerLevel
This method is to obtain the log level of the specified Logger. This method accepts a String type parameter named p1, which is the name of the specified Logger. This method returns the log level of the specified Logger.
It should be noted that the difference between this method and the `getLoggerEffectiveLevel` method is that the method returns the log level that the specified Logger is set in the configuration file. If the user does not set the log level for the Logger. , then return empty. According to Logre's log-level inheritance mechanism, if a Logger is not displayed to set the log level, it will inherit the log level settings from its nearest ancestor. At this point, calling the `getLoggerEffectiveLevel` method will return the log level in which the Logger is in effect; calling the methods described in this section will return null.
......@@ -19,29 +19,11 @@
-->
# Chapter 4: Operation Manual
# Chapter 5: Operation Manual
# DDL (Data Definition Language)
## Sample Data
To make this manual more practical, we will use a specific scenario example to illustrate how to operate IoTDB databases at all stages of use. See [this page](https://github.com/apache/incubator-iotdb/blob/master/docs/Documentation/OtherMaterial-Sample%20Data.txt) for a look. For your convenience, we also provide you with a sample data file in real scenario to import into the IoTDB system for trial and operation.
Download file: [IoTDB-SampleData.txt](https://raw.githubusercontent.com/apache/incubator-iotdb/master/docs/Documentation/OtherMaterial-Sample%20Data.txt).
## Data Model Selection
Before importing data to IoTDB, we first select the appropriate data storage model according to the [sample data](https://raw.githubusercontent.com/apache/incubator-iotdb/master/docs/Documentation/OtherMaterial-Sample%20Data.txt), and then create the storage group and timeseries using [SET STORAGE GROUP](/#/Documents/progress/chap4/sec7) statement and [CREATE TIMESERIES](/#/Documents/progress/chap4/sec7) statement respectively.
### Storage Model Selection
According to the data attribute layers described in [sample data](https://raw.githubusercontent.com/apache/incubator-iotdb/master/docs/Documentation/OtherMaterial-Sample%20Data.txt), we can express it as an attribute hierarchy structure based on the coverage of attributes and the subordinate relationship between them, as shown in Figure 3.1 below. Its hierarchical relationship is: power group layer - power plant layer - device layer - sensor layer. ROOT is the root node, and each node of sensor layer is called a leaf node. In the process of using IoTDB, you can directly connect the attributes on the path from ROOT node to each leaf node with ".", thus forming the name of a timeseries in IoTDB. For example, The left-most path in Figure 3.1 can generate a timeseries named `ROOT.ln.wf01.wt01.status`.
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577327-7aa50780-1ef4-11e9-9d75-cadabb62444e.jpg">
**Figure 3.1 Attribute hierarchy structure**</center>
After getting the name of the timeseries, we need to set up the storage group according to the actual scenario and scale of the data. Because in the scenario of this chapter data is usually arrived in the unit of groups (i.e., data may be across electric fields and devices), in order to avoid frequent switching of IO when writing data, and to meet the user's requirement of physical isolation of data in the unit of groups, we set the storage group at the group layer.
### Storage Group Creation
After selecting the storage model, according to which we can set up the corresponding storage group. The SQL statements for creating storage groups are as follows:
### Create Storage Group
According to the storage model we can set up the corresponding storage group. The SQL statements for creating storage groups are as follows:
```
IoTDB > set storage group to root.ln
......@@ -58,7 +40,7 @@ Msg: org.apache.iotdb.exception.MetadataErrorException: org.apache.iotdb.excepti
```
### Show Storage Group
After the storage group is created, we can use the [SHOW STORAGE GROUP](/#/Documents/progress/chap4/sec7) statement to view all the storage groups. The SQL statement is as follows:
After the storage group is created, we can use the [SHOW STORAGE GROUP](/#/Documents/progress/chap5/sec4) statement to view all the storage groups. The SQL statement is as follows:
```
IoTDB> show storage group
......@@ -67,7 +49,8 @@ IoTDB> show storage group
The result is as follows:
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577338-84c70600-1ef4-11e9-9dab-605b32c02836.jpg"></center>
### Timeseries Creation
### Create Timeseries
According to the storage model selected before, we can create corresponding timeseries in the two storage groups respectively. The SQL statements for creating timeseries are as follows:
```
......@@ -107,10 +90,48 @@ The results are shown below respectly:
It is worth noting that when the queried path does not exist, the system will return no timeseries.
### Precautions
### Count Timeseries
IoTDB are able to use `COUNT TIMESERIES<Path>` to count the amount of timeseries in the path. SQL statements are as follows:
```
IoTDB > COUNT TIMESERIES root
IoTDB > COUNT TIMESERIES root.ln
IoTDB > COUNT TIMESERIES root.ln.*.*.status
IoTDB > COUNT TIMESERIES root.ln.wf01.wt01.status
```
### Delete Timeseries
To delete the timeseries we created before, we are able to use `DELETE TimeSeries <PrefixPath>` statement.
Version 0.7.0 imposes some limitations on the scale of data that users can operate:
The usage are as follows:
```
IoTDB> delete timeseries root.ln.wf01.wt01.status
IoTDB> delete timeseries root.ln.wf01.wt01.temperature, root.ln.wf02.wt02.hardware
IoTDB> delete timeseries root.ln.wf02*
```
### Show Devices
IoTDB supports users to check the devices using `SHOW DEVICES` statement.
SQL statement is as follows:
```
IoTDB> show devices
```
## TTL
IoTDB supports storage-level TTL settings, which means it is able to delete old data automatically and periodically. The benefit of using TTL is that hopefully you can control the total disk space usage and prevent the machine from running out of disks. Moreover, the query performance may downgrade as the total number of files goes up and the memory usage also increase as there are more files. Timely removing such files helps to keep at a high query performance level and reduce memory usage.
### Set TTL
The SQL Statement for setting TTL is as follow:
```
IoTDB> set ttl to root.ln 3600000
```
This example means that for data in `root.ln`, only that of the latest 1 hour will remain, the older one is removed or made invisible.
### Unset TTL
To unset TTL, we can use follwing SQL statement:
```
IoTDB> unset ttl to root.ln
```
After unset TTL, all data will be accepted in `root.ln`
Limit 1: Assuming that the JVM memory allocated to IoTDB at runtime is p and the user-defined size of data in memory written to disk ([group\_size\_in\_byte](/#/Documents/progress/chap3/sec2)) is q, then the number of storage groups should not exceed p/q.
Limit 2: The number of timeseries should not exceed the ratio of JVM memory allocated to IoTDB at run time to 20KB.
<!--
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
......@@ -19,12 +19,73 @@
-->
# Chapter 4: Operation Manual
# Chapter 5: Operation Manual
# DML (Data Manipulation Language)
## INSERT
### Insert Real-time Data
## Data Query
IoTDB provides users with a variety of ways to insert real-time data, such as directly inputting [INSERT SQL statement](/#/Documents/progress/chap5/sec4) in [Client/Shell tools](/#/Tools/Client), or using [Java JDBC](/#/Documents/progress/chap4/sec2) to perform single or batch execution of [INSERT SQL statement](/#/Documents/progress/chap5/sec4).
This section mainly introduces the use of [INSERT SQL statement](/#/Documents/progress/chap5/sec4) for real-time data import in the scenario. See Section 5.4 for a detailed syntax of [INSERT SQL statement](/#/Documents/progress/chap5/sec4).
#### Use of INSERT Statements
The [INSERT SQL statement](/#/Documents/progress/chap5/sec4) statement can be used to insert data into one or more specified timeseries that have been created. For each point of data inserted, it consists of a [timestamp](/#/Documents/progress/chap2/sec1) and a sensor acquisition value (see [Data Type](/#/Documents/progress/chap2/sec2)).
In the scenario of this section, take two timeseries `root.ln.wf02.wt02.status` and `root.ln.wf02.wt02.hardware` as an example, and their data types are BOOLEAN and TEXT, respectively.
The sample code for single column data insertion is as follows:
```
IoTDB > insert into root.ln.wf02.wt02(timestamp,status) values(1,true)
IoTDB > insert into root.ln.wf02.wt02(timestamp,hardware) values(1, "v1")
```
The above example code inserts the long integer timestamp and the value "true" into the timeseries `root.ln.wf02.wt02.status` and inserts the long integer timestamp and the value "v1" into the timeseries `root.ln.wf02.wt02.hardware`. When the execution is successful, cost time is shown to indicate that the data insertion has been completed.
> Note: In IoTDB, TEXT type data can be represented by single and double quotation marks. The insertion statement above uses double quotation marks for TEXT type data. The following example will use single quotation marks for TEXT type data.
The INSERT statement can also support the insertion of multi-column data at the same time point. The sample code of inserting the values of the two timeseries at the same time point '2' is as follows:
```
IoTDB > insert into root.ln.wf02.wt02(timestamp, status, hardware) VALUES (2, false, 'v2')
```
After inserting the data, we can simply query the inserted data using the SELECT statement:
```
IoTDB > select * from root.ln.wf02 where time < 3
```
The result is shown below. From the query results, it can be seen that the insertion statements of single column and multi column data are performed correctly.
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51605021-c2ee1500-1f48-11e9-8f6b-ba9b48875a41.png"></center>
### Error Handling of INSERT Statements
If the user inserts data into a non-existent timeseries, for example, execute the following commands:
```
IoTDB > insert into root.ln.wf02.wt02(timestamp, temperature) values(1,"v1")
```
Because `root.ln.wf02.wt02. temperature` does not exist, the system will return the following ERROR information:
```
Msg: Current deviceId[root.ln.wf02.wt02] does not contain measurement:temperature
```
If the data type inserted by the user is inconsistent with the corresponding data type of the timeseries, for example, execute the following command:
```
IoTDB > insert into root.ln.wf02.wt02(timestamp,hardware) values(1,100)
```
The system will return the following ERROR information:
```
error: The TEXT data type should be covered by " or '
```
## SELECT
### Time Slice Query
This chapter mainly introduces the relevant examples of time slice query using IoTDB SELECT statements. Detailed SQL syntax and usage specifications can be found in [SQL Documentation](/#/Documents/progress/chap4/sec7). You can also use the [Java JDBC](/#/Documents/progress/chap6/sec1) standard interface to execute related queries.
This chapter mainly introduces the relevant examples of time slice query using IoTDB SELECT statements. Detailed SQL syntax and usage specifications can be found in [SQL Documentation](/#/Documents/progress/chap5/sec4). You can also use the [Java JDBC](/#/Documents/progress/chap4/sec2) standard interface to execute related queries.
#### Select a Column of Data Based on a Time Interval
......@@ -83,7 +144,7 @@ The execution result of this SQL statement is as follows:
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577450-dcfe0800-1ef4-11e9-9399-4ba2b2b7fb73.jpg"></center>
### Down-Frequency Aggregate Query
This section mainly introduces the related examples of down-frequency aggregation query, using the [GROUP BY clause](/#/Documents/progress/chap4/sec7), which is used to partition the result set according to the user's given partitioning conditions and aggregate the partitioned result set. IoTDB supports partitioning result sets according to time intervals, and by default results are sorted by time in ascending order. You can also use the [Java JDBC](/#/Documents/progress/chap6/sec1) standard interface to execute related queries.
This section mainly introduces the related examples of down-frequency aggregation query, using the [GROUP BY clause](/#/Documents/progress/chap5/sec4), which is used to partition the result set according to the user's given partitioning conditions and aggregate the partitioned result set. IoTDB supports partitioning result sets according to time intervals, and by default results are sorted by time in ascending order. You can also use the [Java JDBC](/#/Documents/progress/chap4/sec2) standard interface to execute related queries.
The GROUP BY statement provides users with three types of specified parameters:
......@@ -95,7 +156,7 @@ The actual meanings of the three types of parameters are shown in Figure 3.2 bel
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577465-e8513380-1ef4-11e9-84c6-d0690f2a8113.jpg">
**Figure 4.2 The actual meanings of the three types of parameters**</center>
**Figure 5.2 The actual meanings of the three types of parameters**</center>
#### Down-Frequency Aggregate Query without Specifying the Time Axis Origin Position
The SQL statement is:
......@@ -167,7 +228,7 @@ In the actual use of IoTDB, when doing the query operation of timeseries, situat
Automated fill function refers to filling empty values according to the user's specified method and effective time range when performing timeseries queries for single or multiple columns. If the queried point's value is not null, the fill function will not work.
> Note: In the current version 0.7.0, IoTDB provides users with two methods: Previous and Linear. The previous method fills blanks with previous value. The linear method fills blanks through linear fitting. And the fill function can only be used when performing point-in-time queries.
> Note: In the current version, IoTDB provides users with two methods: Previous and Linear. The previous method fills blanks with previous value. The linear method fills blanks through linear fitting. And the fill function can only be used when performing point-in-time queries.
#### Fill Function
* Previous Function
......@@ -273,9 +334,9 @@ When the fill method is not specified, each data type bears its own default fill
### Row and Column Control over Query Results
IoTDB provides [LIMIT/SLIMIT](/#/Documents/progress/chap5/sec1) clause and [OFFSET/SOFFSET](/#/Documents/progress/chap5/sec1) clause in order to make users have more control over query results. The use of LIMIT and SLIMIT clauses allows users to control the number of rows and columns of query results, and the use of OFFSET and SOFSET clauses allows users to set the starting position of the results for display.
IoTDB provides [LIMIT/SLIMIT](/#/Documents/progress/chap5/sec4) clause and [OFFSET/SOFFSET](/#/Documents/progress/chap5/sec4) clause in order to make users have more control over query results. The use of LIMIT and SLIMIT clauses allows users to control the number of rows and columns of query results, and the use of OFFSET and SOFSET clauses allows users to set the starting position of the results for display.
This chapter mainly introduces related examples of row and column control of query results. You can also use the [Java JDBC](/#/Documents/progress/chap6/sec1) standard interface to execute queries.
This chapter mainly introduces related examples of row and column control of query results. You can also use the [Java JDBC](/#/Documents/progress/chap4/sec2) standard interface to execute queries.
#### Row Control over Query Results
By using LIMIT and OFFSET clauses, users can control the query results in a row-related manner. We will demonstrate how to use LIMIT and OFFSET clauses through the following examples.
......@@ -483,3 +544,38 @@ select * from root.ln.wf01.wt01 where time > 2017-11-01T00:05:00.000 and time <
```
The SQL statement will not be executed and the corresponding error prompt is given as follows:
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51578237-cd33f300-1ef7-11e9-9aef-2a717c56ab54.jpg"></center>
## DELETE
Users can delete data that meet the deletion condition in the specified timeseries by using the [DELETE statement](/#/Documents/progress/chap5/sec4). When deleting data, users can select one or more timeseries paths, prefix paths, or paths with star to delete data before a certain time (current version does not support the deletion of data within a closed time interval).
In a JAVA programming environment, you can use the [Java JDBC](/#/Documents/progress/chap4/sec2) to execute single or batch UPDATE statements.
### Delete Single Timeseries
Taking ln Group as an example, there exists such a usage scenario:
The wf02 plant's wt02 device has many segments of errors in its power supply status before 2017-11-01 16:26:00, and the data cannot be analyzed correctly. The erroneous data affected the correlation analysis with other devices. At this point, the data before this time point needs to be deleted. The SQL statement for this operation is
```
delete from root.ln.wf02.wt02.status where time<=2017-11-01T16:26:00;
```
### Delete Multiple Timeseries
When both the power supply status and hardware version of the ln group wf02 plant wt02 device before 2017-11-01 16:26:00 need to be deleted, [the prefix path with broader meaning or the path with star](/#/Documents/progress/chap2/sec1) can be used to delete the data. The SQL statement for this operation is:
```
delete from root.ln.wf02.wt02 where time <= 2017-11-01T16:26:00;
```
or
```
delete from root.ln.wf02.wt02.* where time <= 2017-11-01T16:26:00;
```
It should be noted that when the deleted path does not exist, IoTDB will give the corresponding error prompt as shown below:
```
IoTDB> delete from root.ln.wf03.wt02.status where time < now()
Msg: TimeSeries does not exist and its data cannot be deleted
```
......@@ -19,12 +19,12 @@
-->
# Chapter 4: Operation Manual
# Chapter 5: Operation Manual
## Priviledge Management
IoTDB provides users with priviledge management operations, so as to ensure data security.
## Account Management Statements
IoTDB provides users with account priviledge management operations, so as to ensure data security.
We will show you basic user priviledge management operations through the following specific examples. Detailed SQL syntax and usage details can be found in [SQL Documentation](/#/Documents/progress/chap4/sec7). At the same time, in the JAVA programming environment, you can use the [Java JDBC](/#/Documents/progress/chap6/sec1) to execute priviledge management statements in a single or batch mode.
We will show you basic user priviledge management operations through the following specific examples. Detailed SQL syntax and usage details can be found in [SQL Documentation](/#/Documents/progress/chap5/sec4). At the same time, in the JAVA programming environment, you can use the [Java JDBC](/#/Documents/progress/chap4/sec2) to execute priviledge management statements in a single or batch mode.
### Basic Concepts
#### User
......
......@@ -18,8 +18,9 @@
under the License.
-->
# Chapter 4 Operation Manual
# IoTDB SQL Statement
# Chapter 5: Operation Manual
## SQL Reference
In this part, we will introduce you IoTDB's Query Language. IoTDB offers you a SQL-like query language for interacting with IoTDB, the query language can be devided into 4 major parts:
* Schema Statement: statements about schema management are all listed in this section.
......@@ -29,8 +30,6 @@ In this part, we will introduce you IoTDB's Query Language. IoTDB offers you a S
All of these statements are write in IoTDB's own syntax, for details about the syntax composition, please check the `Reference` section.
## IoTDB Query Statement
### Schema Statement
......@@ -138,6 +137,13 @@ Note: The path can be prefix path or timeseries path.
Note: This statement can be used in IoTDB Client and JDBC.
```
* Show Devices Statement
```
SHOW DEVICE
Eg: IoTDB > SHOW DEVICES
Note: This statement can be used in IoTDB Client and JDBC.
```
### Data Management Statement
* Insert Record Statement
......@@ -524,8 +530,8 @@ Eg: IoTDB > LIST ALL USER OF ROLE roleuser;
```
ALTER USER <username> SET PASSWORD <password>;
roleName:=identifier
password:=string
Eg: IoTDB > UPDATE USER tempuser SET PASSWORD 'newpwd';
password:=identifier
Eg: IoTDB > ALTER USER tempuser SET PASSWORD 'newpwd';
```
### Functions
......
......@@ -19,13 +19,13 @@
-->
# Chapter 9: System Tools
# Chapter 6: System Tools
## Data Import
<!-- TOC -->
- [Chapter 8: System Tools](#chapter-8-system-tools)
- [Chapter 6: System Tools](#chapter-8-system-tools)
- [Data Import](#data-import)
- [Introduction](#introduction)
- [Application Scenario](#application-scenario)
......
......@@ -19,7 +19,7 @@
-->
# Chapter 9: System Tools
# Chapter 6: System Tools
# JMX Tool
......
......@@ -21,7 +21,7 @@ under the License.
-->
# Chapter 9: System Tools
# Chapter 6: System Tools
# Watermark Tool
......
......@@ -19,8 +19,8 @@
-->
# Chapter 5: Management
# Chapter 6: System Tools
# Monitor and Log Tools
## System Monitor
Currently, IoTDB provides users to use Java's JConsole tool to monitor system status or use IoTDB's open API to check data status.
......@@ -357,3 +357,115 @@ Here are the file size statistics:
|Timeseries Name| root.stats.file\_size.SCHEMA |
|Reset After Restarting System| No |
|Example| select SCHEMA from root.stats.file\_size.SCHEMA|
## Performance Monitor
### Introduction
In order to grasp the performance of iotdb, we add this module to count the time-consumption of each operation. This module can compute the statistics of the avg time-consuming of each operation and the proportion of each operation whose time consumption falls into a time range. The output is in log_measure.log file. An output example is below.  
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/60937461-14296f80-a303-11e9-9602-a7bed624bfb3.png">
### Configuration parameter
location:conf/iotdb-engine.properties
<center>**Table -parameter and description**
|Parameter|Default Value|Description|
|:---|:---|:---|
|enable\_performance\_stat|false|Is stat performance of sub-module enable.|
|performance\_stat\_display\_interval|60000|The interval of display statistic result in ms.|
|performance_stat_memory_in_kb|20|The memory used for performance_stat in kb.|
</center>
### JMX MBean
Connect to jconsole with port 31999,and choose ‘MBean’in menu bar. Expand the sidebar and choose 'org.apache.iotdb.db.cost.statistic'. You can Find:
<img style="width:100%; max-width:600px; max-height:200px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/60937484-30c5a780-a303-11e9-8e92-04c413df2088.png">
**Attribute**
1. EnableStat:Whether the statistics are enabled or not, if it is true, the module records the time-consuming of each operation and prints the results; It is non-editable but can be changed by the function below.
2. DisplayIntervalInMs:The interval between print results. The changes will not take effect instantly. To make the changes effective, you should call startContinuousStatistics() or startOneTimeStatistics().
3. OperationSwitch:It's a map to indicate whether the statistics of one kind of operation should be computed, the key is operation name and the value is true means the statistics of the operation are enabled, otherwise disabled. This parameter cannot be changed directly, it's changed by operation 'changeOperationSwitch()'.
**Operation**
1. startContinuousStatistics: Start the statistics and output at interval of ‘DisplayIntervalInMs’.
2. startOneTimeStatistics:Start the statistics and output in delay of ‘DisplayIntervalInMs’.
3. stopStatistic:Stop the statistics.
4. clearStatisticalState(): clear current stat result, reset statistical result.
5. changeOperationSwitch(String operationName, Boolean operationState):set whether to monitor a kind of operation. The param 'operationName' is the name of operation, defined in attribute operationSwitch. The param operationState is whether to enable the statistics or not. If the state is switched successfully, the function will return true, else return false.
### Adding Custom Monitoring Items for contributors of IOTDB
**Add Operation**
Add an enumeration in org.apache.iotdb.db.cost.statistic.Operation.
**Add Timing Code in Monitoring Area**
Add timing code in the monitoring start area:
long t0 = System. currentTimeMillis();
Add timing code in the monitoring stop area:
Measurement.INSTANCE.addOperationLatency(Operation, t0);
## Cache Hit Ratio Statistics
### Overview
To improve query performance, IOTDB caches ChunkMetaData and TsFileMetaData. Users can view the cache hit ratio through debug level log and MXBean, and adjust the memory occupied by the cache according to the cache hit ratio and system memory. The method of using MXBean to view cache hit ratio is as follows:
1. Connect to jconsole with port 31999 and select 'MBean' in the menu item above.
2. Expand the sidebar and select 'org.apache.iotdb.db.service'. You will get the results shown in the following figure:
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/65687623-404fc380-e09c-11e9-83c3-3c7c63a5b0be.jpeg">
## System log
IoTDB allows users to configure IoTDB system logs (such as log output level) by modifying the log configuration file. The default location of the system log configuration file is in \$IOTDB_HOME/conf folder.
The default log configuration file is named logback.xml. The user can modify the configuration of the system running log by adding or changing the xml tree node parameters. It should be noted that the configuration of the system log using the log configuration file does not take effect immediately after the modification, instead, it will take effect after restarting the system. The usage of logback.xml is just as usual.
At the same time, in order to facilitate the debugging of the system by the developers and DBAs, we provide several JMX interfaces to dynamically modify the log configuration, and configure the Log module of the system in real time without restarting the system.
### Dynamic System Log Configuration
#### Connect JMX
Here we use JConsole to connect with JMX.
Start the JConsole, establish a new JMX connection with the IoTDB Server (you can select the local process or input the IP and PORT for remote connection, the default operation port of the IoTDB JMX service is 31999). Fig 4.1 shows the connection GUI of JConsole.
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577195-f94d7500-1ef3-11e9-999a-b4f67055d80e.png">
After connected, click `MBean` and find `ch.qos.logback.classic.default.ch.qos.logback.classic.jmx.JMXConfigurator`(As shown in fig 4.2).
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577204-fe122900-1ef3-11e9-9e89-2eb1d46e24b8.png">
In the JMXConfigurator Window, there are 6 operations provided for you, as shown in fig 4.3. You can use there interfaces to perform operation.
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577216-09fdeb00-1ef4-11e9-9005-542ad7d9e9e0.png">
#### Interface Instruction
* reloadDefaultConfiguration
This method is to reload the default logback configuration file. The user can modify the default configuration file first, and then call this method to reload the modified configuration file into the system to take effect.
* reloadByFileName
This method loads a logback configuration file with the specified path and name, and then makes it take effect. This method accepts a parameter of type String named p1, which is the path to the configuration file that needs to be specified for loading.
* getLoggerEffectiveLevel
This method is to obtain the current log level of the specified Logger. This method accepts a String type parameter named p1, which is the name of the specified Logger. This method returns the log level currently in effect for the specified Logger.
* getLoggerLevel
This method is to obtain the log level of the specified Logger. This method accepts a String type parameter named p1, which is the name of the specified Logger. This method returns the log level of the specified Logger.
It should be noted that the difference between this method and the `getLoggerEffectiveLevel` method is that the method returns the log level that the specified Logger is set in the configuration file. If the user does not set the log level for the Logger. , then return empty. According to Logger's log-level inheritance mechanism, f a Logger's level is not explicitly set, it will inherit the log level settings from its nearest ancestor. At this point, calling the `getLoggerEffectiveLevel` method will return the log level in which the Logger is in effect; calling `getLoggerLevel` will return null.
......@@ -18,7 +18,7 @@
under the License.
-->
# Chapter 10: Ecosystem Integration
# Chapter 7: Ecosystem Integration
# Grafana
<!-- TOC -->
## Outline
......
......@@ -18,7 +18,7 @@
under the License.
-->
# Chapter 10: Ecosystem Integration
# Chapter 7: Ecosystem Integration
# TsFile-Hadoop-Connector
<!-- TOC -->
## Outline
......
......@@ -19,7 +19,7 @@
-->
# Chapter 10: Ecosystem Integration
# Chapter 7: Ecosystem Integration
# TsFile-Spark-Connector User Guide
......
......@@ -18,7 +18,7 @@
under the License.
-->
# Chapter 10: Ecosystem Integration
# Chapter 7: Ecosystem Integration
# Spark IoTDB Connecter
## version
......
......@@ -19,7 +19,7 @@
-->
# Chapter 7: System Design
# Chapter 8: System Design (Developer)
## TsFile Hierarchy
......
......@@ -19,10 +19,9 @@
-->
# Chapter 5: Management
# Chapter 8: System Design (Developer)
## Data Management
## Files
In IoTDB, there are many kinds of data needed to be storage. In this section, we will introduce IoTDB's data storage strategy in order to give you an intuitive understanding of IoTDB's data management.
......
......@@ -19,7 +19,9 @@
-->
# Chapter 8: Distributed Architecture
# Chapter 8: System Design (Developer)
# Writing Data on HDFS
## Shared Storage Architecture
......
......@@ -19,7 +19,7 @@
-->
# Chapter 8: Distributed Architecture
# Chapter 8: System Design (Developer)
## Shared Nothing Architecture
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册