This is an automated email from the ASF dual-hosted git repository.
gongchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/master by this push:
new 1c82ce90f [improve] deprecate support iotdb 0.* version (#2032)
1c82ce90f is described below
commit 1c82ce90f142e6d9b485b54ea04fba5c68d14829
Author: Ceilzcx <[email protected]>
AuthorDate: Sat May 25 12:21:10 2024 +0800
[improve] deprecate support iotdb 0.* version (#2032)
---
home/docs/start/iotdb-init.md | 10 ++---
.../current/start/iotdb-init.md | 28 ++++++-------
manager/src/main/resources/application.yml | 2 -
.../store/history/iotdb/IotDbDataStorage.java | 46 ++++++++++------------
.../store/history/iotdb/IotDbProperties.java | 1 -
.../store/history/iotdb/IotDbVersion.java | 32 ---------------
6 files changed, 35 insertions(+), 84 deletions(-)
diff --git a/home/docs/start/iotdb-init.md b/home/docs/start/iotdb-init.md
index cb54c1bed..ee7a66a87 100644
--- a/home/docs/start/iotdb-init.md
+++ b/home/docs/start/iotdb-init.md
@@ -7,7 +7,7 @@ Apache HertzBeat (incubating)'s historical data storage relies
on the time serie
> It is recommended to use VictoriaMetrics as metrics storage.
-Apache IoTDB is a software system that integrates the collection, storage,
management and analysis of time series data of the Internet of Things. We use
it to store and analyze the historical data of monitoring metrics collected.
Support V0.13+ version and V1.0.+ version.
+Apache IoTDB is a software system that integrates the collection, storage,
management and analysis of time series data of the Internet of Things. We use
it to store and analyze the historical data of monitoring metrics collected.
Support V1.0.+ version.
**Note⚠️ Time series database is optional, but production environment
configuration is strongly recommended to provide more complete historical chart
functions and high performance**
@@ -58,8 +58,6 @@ warehouse:
rpc-port: 6667
username: root
password: root
- # config.org.apache.hertzbeat.warehouse.IotDbVersion: V_0_13 || V_1_0
- version: V_1_0
query-timeout-in-ms: -1
# default '7776000000'(90days,unit:ms,-1:no-expire)
expire-time: '7776000000'
@@ -81,8 +79,6 @@ warehouse:
node-urls: ['127.0.0.1:6667','127.0.0.2:6667','127.0.0.3:6667']
username: root
password: root
- # V_0_13 || V_1_0
- version: V_1_0
# if iotdb version >= 0.13 use default queryTimeoutInMs = -1; else use
default queryTimeoutInMs = 0
query-timeout-in-ms: -1
# Data storage time: default '7776000000' (90 days, in milliseconds, -1
means never expire)
@@ -93,14 +89,14 @@ Configuration parameters:
| Parameter Name | Description
|
-| ------------------- |
-----------------------------------------------------------------------------------------
|
+| -------------------
|-------------------------------------------------------------------------------------------|
| enabled | Whether to enable
|
| host | IoTDB database address
|
| rpc-port | IoTDB database port
|
| node-urls | IoTDB cluster addresses
|
| username | IoTDB database account
|
| password | IoTDB database password
|
-| version | IoTDB database version, V_0_13 or V_1_0
|
+| version | deprecated
|
| query-timeout-in-ms | Query timeout
|
| expire-time | Data storage time, default '7776000000' (90 days, in
milliseconds, -1 means never expire) |
diff --git
a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/start/iotdb-init.md
b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/start/iotdb-init.md
index 8d44d0c0a..b4888e2af 100644
--- a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/start/iotdb-init.md
+++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/start/iotdb-init.md
@@ -7,7 +7,7 @@ Apache HertzBeat (incubating) 的历史数据存储依赖时序数据库,任
> 我们推荐使用并长期支持 VictoriaMetrics 作为存储。
-Apache IoTDB是一体化收集、存储、管理与分析物联网时序数据的软件系统,我们使用其存储分析采集到的监控指标历史数据。支持V0.12 -
V0.13版本,推荐使用V0.13.*版本。
+Apache
IoTDB是一体化收集、存储、管理与分析物联网时序数据的软件系统,我们使用其存储分析采集到的监控指标历史数据。支持V1.*版本,废弃V0.*版本的支持。
**注意⚠️ 时序数据库安装配置为可选项,但强烈建议生产环境配置,以提供更完善的历史图表功能,高性能和稳定性**
@@ -60,9 +60,7 @@ warehouse:
rpc-port: 6667
username: root
password: root
- # V_0_13 || V_1_0
- version: V_1_0
- # if iotdb version >= 0.13 use default queryTimeoutInMs = -1; else use
default queryTimeoutInMs = 0
+ # use default queryTimeoutInMs = -1
query-timeout-in-ms: -1
# 数据存储时间:默认'7776000000'(90天,单位为毫秒,-1代表永不过期)
expire-time: '7776000000'
@@ -83,8 +81,6 @@ warehouse:
node-urls: ['127.0.0.1:6667','127.0.0.2:6667','127.0.0.3:6667'']
username: root
password: root
- # V_0_13 || V_1_0
- version: V_1_0
# if iotdb version >= 0.13 use default queryTimeoutInMs = -1; else use
default queryTimeoutInMs = 0
query-timeout-in-ms: -1
# 数据存储时间:默认'7776000000'(90天,单位为毫秒,-1代表永不过期)
@@ -94,16 +90,16 @@ warehouse:
参数说明:
-| 参数名称 | 参数说明
|
-| ------------------- |
---------------------------------------------------------------- |
-| enabled | 是否启用
|
-| host | IoTDB数据库地址
|
-| rpc-port | IoTDB数据库端口
|
-| node-urls | IoTDB集群地址
|
-| username | IoTDB数据库账户
|
-| password | IoTDB数据库密码
|
-| version | IoTDB数据库版本,V_0_13 、 V_1_0
|
-| query-timeout-in-ms | 查询超时时间
|
+| 参数名称 | 参数说明 |
+| ------------------- |-------------------------------------------|
+| enabled | 是否启用 |
+| host | IoTDB数据库地址 |
+| rpc-port | IoTDB数据库端口 |
+| node-urls | IoTDB集群地址 |
+| username | IoTDB数据库账户 |
+| password | IoTDB数据库密码 |
+| version | IoTDB数据库版本,已废弃,仅支持V1.* |
+| query-timeout-in-ms | 查询超时时间 |
| expire-time | 数据存储时间,默认'7776000000'(90天,单位为毫秒,-1代表永不过期) |
> 如果集群配置`node-urls`和单机配置同时设置,以集群`node-urls`配置稳准
diff --git a/manager/src/main/resources/application.yml
b/manager/src/main/resources/application.yml
index 3e5d97116..e086e4952 100644
--- a/manager/src/main/resources/application.yml
+++ b/manager/src/main/resources/application.yml
@@ -148,8 +148,6 @@ warehouse:
rpc-port: 6667
username: root
password: root
- # config.org.apache.hertzbeat.warehouse.IotDbVersion: V_0_13 || V_1_0
- version: V_1_0
query-timeout-in-ms: -1
# data expire time, unit:ms, default '7776000000'(90 days, -1:never
expire)
expire-time: '7776000000'
diff --git
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbDataStorage.java
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbDataStorage.java
index 44a2512b5..777a0a7d3 100644
---
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbDataStorage.java
+++
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbDataStorage.java
@@ -61,9 +61,6 @@ public class IotDbDataStorage extends
AbstractHistoryDataStorage {
private static final String SHOW_DATABASE = "show databases %s";
- /**
- * create database (version 1.0.*)
- */
private static final String CREATE_DATABASE = "create database %s";
private static final String SET_TTL = "set ttl to %s %s";
@@ -81,8 +78,6 @@ public class IotDbDataStorage extends
AbstractHistoryDataStorage {
private SessionPool sessionPool;
- private IotDbVersion version;
-
private long queryTimeoutInMs;
public IotDbDataStorage(IotDbProperties iotDbProperties) {
@@ -107,25 +102,26 @@ public class IotDbDataStorage extends
AbstractHistoryDataStorage {
if (properties.zoneId() != null) {
builder.zoneId(properties.zoneId());
}
- if (properties.version() != null) {
- this.version = properties.version();
- }
this.queryTimeoutInMs = properties.queryTimeoutInMs();
this.sessionPool = builder.build();
boolean available = checkConnection();
- if (available) {
- available = this.createDatabase();
- if (available) {
- this.initTtl(properties.expireTime());
- log.info("IotDB session pool init success");
- }
+ if (!available) {
+ log.error("IotDB session pool init error with check connection");
+ return available;
+ }
+ available = this.createDatabase();
+ if (!available) {
+ log.error("IotDB session pool init error with create database");
+ return available;
}
+ this.initTtl(properties.expireTime());
+ log.info("IotDB session pool init success");
return available;
}
private boolean checkConnection() {
try {
- this.sessionPool.executeQueryStatement(SHOW_STORAGE_GROUP);
+ this.sessionPool.executeNonQueryStatement(SHOW_STORAGE_GROUP);
return true;
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -136,15 +132,12 @@ public class IotDbDataStorage extends
AbstractHistoryDataStorage {
private boolean createDatabase() {
SessionDataSetWrapper dataSet = null;
try {
- // v1.0.* create database
- if (IotDbVersion.V_1_0.equals(this.version)) {
- String showDatabaseSql = String.format(SHOW_DATABASE,
STORAGE_GROUP);
- dataSet =
this.sessionPool.executeQueryStatement(showDatabaseSql);
- // root.hertzbeat database not exist
- if (!dataSet.hasNext()) {
- String createDatabaseSql = String.format(CREATE_DATABASE,
STORAGE_GROUP);
-
this.sessionPool.executeNonQueryStatement(createDatabaseSql);
- }
+ // if root.hertzbeat database not exist, create database
+ String showDatabaseSql = String.format(SHOW_DATABASE,
STORAGE_GROUP);
+ dataSet = this.sessionPool.executeQueryStatement(showDatabaseSql);
+ if (!dataSet.hasNext()) {
+ String createDatabaseSql = String.format(CREATE_DATABASE,
STORAGE_GROUP);
+ this.sessionPool.executeNonQueryStatement(createDatabaseSql);
}
} catch (IoTDBConnectionException | StatementExecutionException e) {
log.error("create database error, error: {}", e.getMessage());
@@ -188,7 +181,6 @@ public class IotDbDataStorage extends
AbstractHistoryDataStorage {
List<MeasurementSchema> schemaList = new ArrayList<>();
// todo Measurement schema is a data structure that is generated on
the client side, and encoding and compression have no effect
- // todo Do you want to use the specified data structure, or do you
want to create a timeSeries or template manually
List<CollectRep.Field> fieldsList = metricsData.getFieldsList();
for (CollectRep.Field field : fieldsList) {
MeasurementSchema schema = new MeasurementSchema();
@@ -198,6 +190,8 @@ public class IotDbDataStorage extends
AbstractHistoryDataStorage {
schema.setType(TSDataType.DOUBLE);
} else if (field.getType() == CommonConstants.TYPE_STRING) {
schema.setType(TSDataType.TEXT);
+ } else {
+ continue;
}
schemaList.add(schema);
}
@@ -421,7 +415,7 @@ public class IotDbDataStorage extends
AbstractHistoryDataStorage {
String deviceId = STORAGE_GROUP + "."
+ (useQuote ? addQuote(app) : app) + "."
+ (useQuote ? addQuote(metrics) : metrics) + "."
- + ((IotDbVersion.V_1_0.equals(version) || useQuote) ?
addQuote(monitorId.toString()) : monitorId.toString());
+ + addQuote(monitorId.toString());
if (labels != null && !labels.isEmpty() &&
!labels.equals(CommonConstants.NULL_VALUE)) {
deviceId += "." + addQuote(labels);
}
diff --git
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbProperties.java
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbProperties.java
index cc9e0e7a9..9d1188b69 100644
---
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbProperties.java
+++
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbProperties.java
@@ -42,7 +42,6 @@ public record IotDbProperties(@DefaultValue("false") boolean
enabled,
String password,
List<String> nodeUrls,
ZoneId zoneId,
- IotDbVersion version,
long queryTimeoutInMs,
String expireTime) {
}
diff --git
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbVersion.java
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbVersion.java
deleted file mode 100644
index 3f756c7c7..000000000
---
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbVersion.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.hertzbeat.warehouse.store.history.iotdb;
-
-/**
- * IoTDB user version
- */
-public enum IotDbVersion {
- /**
- * version 0.13.*
- */
- V_0_13,
- /**
- * version 1.0.*
- */
- V_1_0
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]