Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: greptimedb can't work with version >= 0.5 #2095

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions home/docs/start/greptime-init.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Apache HertzBeat (incubating)'s historical data storage relies on the time serie

> It is recommended to use VictoriaMetrics as metrics storage.

GreptimeDB is an open-source time-series database with a special focus on scalability, analytical capabilities and efficiency.
[GreptimeDB](https://github.com/GreptimeTeam/greptimedb) is an open-source time-series database with a special focus on scalability, analytical capabilities and efficiency.

It's designed to work on infrastructure of the cloud era, and users benefit from its elasticity and commodity storage.

Expand All @@ -26,21 +26,24 @@ It's designed to work on infrastructure of the cloud era, and users benefit from
2. Install GreptimeDB with Docker

```shell
$ docker run -p 4000-4004:4000-4004 \
-p 4242:4242 -v /opt/greptimedb:/tmp/greptimedb \
--name greptime \
greptime/greptimedb standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
$ docker run -p 127.0.0.1:4000-4003:4000-4003 \
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
greptime/greptimedb:latest standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
```
`-v /opt/greptimedb:/tmp/greptimedb` is local persistent mount of greptimedb data directory. `/opt/greptimedb` should be replaced with the actual local directory.

`-v "$(pwd)/greptimedb:/tmp/greptimedb"` is local persistent mount of greptimedb data directory. `$(pwd)/greptimedb` should be replaced with the actual local directory, default is the `greptimedb` directory under the current directory.
use```$ docker ps``` to check if the database started successfully

### Configure the database connection in hertzbeat `application.yml` configuration file

1. Configure HertzBeat's configuration file
Modify `hertzbeat/config/application.yml` configuration file
Note⚠️The docker container way need to mount application.yml file locally, while you can use installation package way to unzip and modify `hertzbeat/config/application.yml`
Modify `hertzbeat/config/application.yml` configuration file [/script/application.yml](https://github.com/apache/hertzbeat/raw/master/script/application.yml)
Note⚠️The docker container way need to mount application.yml file locally, while you can use installation package way to unzip and modify `hertzbeat/config/application.yml`
Replace `warehouse.store.greptime` data source parameters, URL account and password.

```yaml
Expand All @@ -52,9 +55,15 @@ warehouse:
# enable greptime
greptime:
enabled: true
endpoint: localhost:4001
grpc-endpoints: localhost:4001
url: jdbc:mysql://localhost:4002/hertzbeat?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: greptime
password: greptime
```

The default database is `hertzbeat` in the `url`.

2. Restart HertzBeat

### FAQ
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
id: greptime-init
title: 依赖时序数据库服务GreptimeDB安装初始化(可选)
sidebar_label: 指标数据存储GreptimeDB
title: 依赖时序数据库服务 GreptimeDB 安装初始化(可选)
sidebar_label: 指标数据存储 GreptimeDB
---

Apache HertzBeat (incubating) 的历史数据存储依赖时序数据库,任选其一安装初始化即可,也可不安装(注意⚠️但强烈建议生产环境配置)

> 我们推荐使用并长期支持 VictoriaMetrics 作为存储。

GreptimeDB is an open-source time-series database with a special focus on scalability, analytical capabilities and efficiency.
[GreptimeDB](https://github.com/GreptimeTeam/greptimedb) is an open-source time-series database with a special focus on scalability, analytical capabilities and efficiency.
It's designed to work on infrastructure of the cloud era, and users benefit from its elasticity and commodity storage.

**⚠️ 若不配置时序数据库,则只会留最近一小时历史数据**
Expand All @@ -25,21 +25,24 @@ It's designed to work on infrastructure of the cloud era, and users benefit from
2. Docker安装GreptimeDB

```shell
$ docker run -p 4000-4004:4000-4004 \
-p 4242:4242 -v /opt/greptimedb:/tmp/greptimedb \
--name greptime \
greptime/greptimedb standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001
$ docker run -p 127.0.0.1:4000-4003:4000-4003 \
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
greptime/greptimedb:latest standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
```

`-v /opt/greptimedb:/tmp/greptimedb` 为greptimedb数据目录本地持久化挂载,需将`/opt/greptimedb`替换为实际本地存在的目录
`-v "$(pwd)/greptimedb:/tmp/greptimedb` 为 greptimedb 数据目录本地持久化挂载,需将 `$(pwd)/greptimedb` 替换为实际本地存在的目录,默认使用执行命令的当前目录下的 `greptimedb` 目录作为数据目录。

使用```$ docker ps```查看数据库是否启动成功

### 在hertzbeat的`application.yml`配置文件配置此数据库连接

1. 配置HertzBeat的配置文件
修改位于 `hertzbeat/config/application.yml` 的配置文件
修改位于 `hertzbeat/config/application.yml` 的配置文件 [/script/application.yml](https://github.com/apache/hertzbeat/raw/master/script/application.yml)
注意⚠️docker容器方式需要将application.yml文件挂载到主机本地,安装包方式解压修改位于 `hertzbeat/config/application.yml` 即可

**修改里面的`warehouse.store.jpa.enabled`参数为`false`, 配置里面的`warehouse.store.greptime`数据源参数,URL账户密码,并启用`enabled`为`true`**
Expand All @@ -52,9 +55,15 @@ warehouse:
enabled: false
greptime:
enabled: true
endpoint: localhost:4001
grpc-endpoints: localhost:4001
url: jdbc:mysql://localhost:4002/hertzbeat?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: greptime
password: greptime
```

默认数据库是 URL 中配置的 `hertzbeat` 。

2. 重启 HertzBeat

### 常见问题
Expand Down
6 changes: 5 additions & 1 deletion manager/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ warehouse:
password: taosdata
greptime:
enabled: false
endpoint: localhost:4001
grpc-endpoints: localhost:4001
url: jdbc:mysql://localhost:4002/hertzbeat?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: greptime
password: greptime
iot-db:
enabled: false
host: 127.0.0.1
Expand Down
32 changes: 8 additions & 24 deletions warehouse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
<influxdb.version>2.23</influxdb.version>
<spring-cloud-starter-openfeign.version>3.0.5</spring-cloud-starter-openfeign.version>
<taos-jdbcdriver.version>3.0.0</taos-jdbcdriver.version>
<greptimedb.version>0.4.0</greptimedb.version>
<greptimedb.version>0.7.3</greptimedb.version>
<mysql-jdbcdriver.version>8.0.33</mysql-jdbcdriver.version>
</properties>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -81,10 +82,10 @@
<artifactId>influxdb-java</artifactId>
<version>${influxdb.version}</version>
</dependency>

<!-- greptimedb -->
<dependency>
<groupId>io.greptime</groupId>
<artifactId>greptimedb-protocol</artifactId>
<artifactId>ingester-all</artifactId>
<version>${greptimedb.version}</version>
<exclusions>
<exclusion>
Expand All @@ -105,28 +106,11 @@
</exclusion>
</exclusions>
</dependency>
<!-- mysql -->
<dependency>
<groupId>io.greptime</groupId>
<artifactId>greptimedb-grpc</artifactId>
<version>${greptimedb.version}</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-jdbcdriver.version}</version>
</dependency>
<!-- kafka -->
<dependency>
Expand Down
Loading
Loading