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

add docker-compose script hertzbeat+mysql+victoria-metrics all in one #1370

Merged
merged 10 commits into from
Dec 2, 2023
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
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

> An open-source, real-time monitoring system with custom monitoring, high performance cluster and agentless capabilities. | 易用友好的开源实时监控告警系统,无需Agent,高性能集群,强大自定义监控能力.

[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8139/badge)](https://www.bestpractices.dev/projects/8139)
[![Docker Pulls](https://img.shields.io/docker/pulls/tancloud/hertzbeat?style=%20for-the-badge&logo=docker&label=DockerHub%20Download)](https://hub.docker.com/repository/docker/tancloud/hertzbeat/general)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/hertzbeat)](https://artifacthub.io/packages/search?repo=hertzbeat)
[![discord](https://img.shields.io/badge/chat-on%20discord-brightgreen)](https://discord.gg/Fb6M73htGr)
Expand Down Expand Up @@ -157,13 +158,13 @@ Detailed config refer to [Install HertzBeat via Package](https://hertzbeat.com/d

Detailed steps refer to [CONTRIBUTING](CONTRIBUTING.md)

##### 4:Install All(hertzbeat+mysql+iotdb/tdengine) via Docker-compose
##### 4:Install All(hertzbeat+mysql+tsdb) via Docker-compose

Install the mysql database, iotdb/tdengine database and hertzbeat at one time through [docker-compose deployment script](script/docker-compose).
Install the mysql/postgresql database, iotdb/tdengine/victoria-metrics database and hertzbeat at one time through [docker-compose deployment script](script/docker-compose).

Detailed steps refer to [Install via Docker-Compose](script/docker-compose/README.md)

##### 5. Install All(hertzbeat+collector+mysql+iotdb) via kubernetes helm charts
##### 5. Install All(hertzbeat+collector+mysql+tsdb) via kubernetes helm charts

Install HertzBeat cluster in a Kubernetes cluster by Helm chart.

Expand Down Expand Up @@ -395,7 +396,7 @@ HertzBeat is a top project under the [Dromara Open Source Community](https://dro

##### Channel

**WeChat Group** : Add friend `tan-cloud`, and will invite you to the group.
WeChat Group : Add friend `tan-cloud`, and will invite you to the group.

[QQ Group](https://jq.qq.com/?_wv=1027&k=Bud9OzdI) : Add group num `236915833`

Expand All @@ -415,11 +416,11 @@ HertzBeat is a top project under the [Dromara Open Source Community](https://dro

##### Public

<img alt="tan-cloud" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat/home/static/img/wechat.png" width="400"/>
<img alt="tan-cloud" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat/home/static/img/wechat.png" width="300"/>

<br/>

<img alt="planet" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/planet.jpg" width="400"/>
<img alt="planet" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/planet.jpg" width="300"/>

##### Friends

Expand Down Expand Up @@ -447,9 +448,9 @@ HertzBeat is built on so many great open source projects, thanks to them!
## Landscape

<p align="left">
<img src="./home/static/img/home/cncf-landscape-left-logo.svg" width="175">&nbsp;&nbsp;<img src="./home/static/img/home/cncf-right-logo.svg" width="200" />
<img src="./home/static/img/home/cncf-landscape-left-logo.svg" width="300">&nbsp;&nbsp;<img src="./home/static/img/home/cncf-right-logo.svg" width="345" />
<br /><br />
HertzBeat enriches the <a href="https://landscape.cncf.io/card-mode?category=monitoring&grouping=category">
HertzBeat has been included in the <a href="https://landscape.cncf.io/card-mode?category=monitoring&grouping=category">
CNCF Observability And Analysis - Monitoring Landscape.</a>
</p>

Expand Down
23 changes: 12 additions & 11 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

> 易用友好的开源实时监控告警系统,无需Agent,高性能集群,强大自定义监控能力。

[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8139/badge)](https://www.bestpractices.dev/projects/8139)
[![Docker Pulls](https://img.shields.io/docker/pulls/tancloud/hertzbeat?style=%20for-the-badge&logo=docker&label=DockerHub%20Download)](https://hub.docker.com/repository/docker/tancloud/hertzbeat/general)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/hertzbeat)](https://artifacthub.io/packages/search?repo=hertzbeat)
[![discord](https://img.shields.io/badge/chat-on%20discord-brightgreen)](https://discord.gg/Fb6M73htGr)
Expand Down Expand Up @@ -155,13 +156,13 @@ docker run -d -e IDENTITY=custom-collector-name -e MANAGER_HOST=127.0.0.1 -e MAN

详细步骤参考 [参与贡献之本地代码启动](CONTRIBUTING.md)

##### 方式四:Docker-Compose 统一安装 hertzbeat+mysql+iotdb/tdengine
##### 方式四:Docker-Compose 统一安装 hertzbeat+mysql+tsdb

通过 [Docker-Compose 部署脚本](script/docker-compose) 一次性把 mysql 数据库, iotdb/tdengine 时序数据库和 hertzbeat 安装部署。
通过 [Docker-Compose 部署脚本](script/docker-compose) 一次性把 mysql/postgresql 数据库, iotdb/tdengine/victoria-metrics 时序数据库和 hertzbeat 安装部署。

详细步骤参考 [通过Docker-Compose安装HertzBeat](script/docker-compose/README.md)

##### 方式五:Kubernetes Helm Charts 部署 hertzbeat+collector+mysql+iotdb
##### 方式五:Kubernetes Helm Charts 部署 hertzbeat+collector+mysql+tsdb

通过 Helm Chart 一次性将 HertzBeat 集群组件部署到 Kubernetes 集群中。

Expand Down Expand Up @@ -393,14 +394,14 @@ HertzBeat 赫兹跳动是 [Dromara开源社区](https://dromara.org/) 下顶级

##### 微信交流群

加微信号 tan-cloud 或 扫描下面账号二维码拉您进微信群。
<img alt="tan-cloud" src="home/static/img/docs/help/tan-cloud-wechat.jpg" width="200"/>
加微信号 `tan-cloud` 或 扫描下面账号二维码拉您进微信群。
<img alt="tan-cloud" src="home/static/img/docs/help/tan-cloud-wechat.jpg" width="150"/>

##### QQ交流群

加QQ群号 236915833 或 扫描下面的群二维码进群
加QQ群号 `236915833` 或 扫描下面的群二维码进群

<img alt="tan-cloud" src="home/static/img/docs/help/qq-qr.jpg" width="200"/>
<img alt="tan-cloud" src="home/static/img/docs/help/qq-qr.jpg" width="150"/>

##### Channel

Expand All @@ -420,11 +421,11 @@ HertzBeat 赫兹跳动是 [Dromara开源社区](https://dromara.org/) 下顶级

##### 公众号与星球

<img alt="tan-cloud" src="home/static/img/wechat.png" width="400"/>
<img alt="tan-cloud" src="home/static/img/wechat.png" width="300"/>

<br/>

<img alt="planet" src="home/static/img/planet.jpg" width="400"/>
<img alt="planet" src="home/static/img/planet.jpg" width="300"/>

##### 友情链接

Expand Down Expand Up @@ -464,9 +465,9 @@ HertzBeat is built on so many great open source projects, thanks to them!
## Landscape

<p align="left">
<img src="./home/static/img/home/cncf-landscape-left-logo.svg" width="175">&nbsp;&nbsp;<img src="./home/static/img/home/cncf-right-logo.svg" width="200" />
<img src="./home/static/img/home/cncf-landscape-left-logo.svg" width="300">&nbsp;&nbsp;<img src="./home/static/img/home/cncf-right-logo.svg" width="345" />
<br /><br />
HertzBeat enriches the <a href="https://landscape.cncf.io/card-mode?category=monitoring&grouping=category">
HertzBeat has been included in the <a href="https://landscape.cncf.io/card-mode?category=monitoring&grouping=category">
CNCF Observability And Analysis - Monitoring Landscape.</a>
</p>

Expand Down
4 changes: 2 additions & 2 deletions home/docs/start/iotdb-init.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ $ docker run -d -p 6667:6667 -p 31999:31999 -p 8181:8181 \
apache/iotdb:0.13.3-node
```

`-v /opt/iotdb/data:/iotdb/data` is local persistent mount of TDengine data directory.`/iotdb/data` should be replaced with the actual local directory.
`-v /opt/iotdb/data:/iotdb/data` is local persistent mount of IotDB data directory.`/iotdb/data` should be replaced with the actual local directory.
use```$ docker ps``` to check if the database started successfully

3. Configure the database connection in hertzbeat `application.yml`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`
Replace `warehouse.store.iot-db` data source parameters, HOST account and password.
Config the `warehouse.store.jpa.enabled` `false`. Replace `warehouse.store.iot-db` data source parameters, HOST account and password.

```
warehouse:
Expand Down
63 changes: 63 additions & 0 deletions home/docs/start/victoria-metrics-init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
id: victoria-metrics-init
title: Use Time Series Database VictoriaMetrics to Store Metrics Data (Optional)
sidebar_label: Use VictoriaMetrics Store Metrics
---

HertzBeat's historical data storage relies on the time series database VictoriaMetrics(Recommend), IoTDB or TDengine, you can choose one of them to install and initialize, or not to install (note ⚠️ but it is strongly recommended to configure in the production environment)

VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database.Recommend Version(VictoriaMetrics:v1.95.1+, HertzBeat:v1.4.3+)

**Note⚠️ Time series database is optional, but production environment configuration is strongly recommended to provide more complete historical chart functions and high performance**
**⚠️ If you do not configure a time series database, only the last hour of historical data is retained.**

> If you already have an VictoriaMetrics environment, you can skip directly to the YML configuration step.

### Install VictoriaMetrics via Docker
> Refer to the official website [installation tutorial](https://docs.victoriametrics.com/Quick-Start.html#how-to-install)
1. Download and install Docker environment
Docker tools download refer to [Docker official document](https://docs.docker.com/get-docker/).
After the installation you can check if the Docker version normally output at the terminal.
```
$ docker -v
Docker version 20.10.12, build e91ed57
```

2. Install VictoriaMetrics via Docker

```shell
$ docker run -d -p 8428:8428 \
-v $(pwd)/victoria-metrics-data:/victoria-metrics-data \
--name victoria-metrics \
victoriametrics/victoria-metrics:v1.95.1
```

`-v $(pwd)/victoria-metrics-data:/victoria-metrics-data` is local persistent mount of VictoriaMetrics data directory
use```$ docker ps``` to check if the database started successfully

3. Configure the database connection in hertzbeat `application.yml`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`
Config the `warehouse.store.jpa.enabled` `false`. Replace `warehouse.store.victoria-metrics` data source parameters, HOST account and password.

```yaml
warehouse:
store:
# disable JPA
jpa:
enabled: false
# enable victoria-metrics
victoria-metrics:
enabled: true
url: http://localhost:8428
username: root
password: root
```

4. Restart HertzBeat

### FAQ

1. Do both the time series databases need to be configured? Can they both be used?
> You don't need to configure all of them, you can choose one of them. Use the enable parameter to control whether it is used or not. You can also install and configure neither, which can affects the historical chart data.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
id: victoria-metrics-init
title: 依赖时序数据库服务VictoriaMetrics安装初始化
sidebar_label: 使用VictoriaMetrics存储指标数据(可选)
---

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

VictoriaMetrics,是一个快速高效、经济并且可扩展的监控解决方案和时序数据库,兼容 Prometheus 生态。推荐版本(VictoriaMetrics:v1.95.1+, HertzBeat:v1.4.3+)

**注意⚠️ 时序数据库安装配置为可选项,但强烈建议生产环境配置,以提供更完善的历史图表功能,高性能和稳定性**
**⚠️ 若不配置时序数据库,则只会留最近一小时历史数据**

> 如果您已有VictoriaMetrics环境,可直接跳到YML配置那一步。


### 通过Docker方式安装VictoriaMetrics
> 可参考官方网站[安装教程](https://docs.victoriametrics.com/Quick-Start.html#how-to-install)
1. 下载安装Docker环境
Docker 工具自身的下载请参考 [Docker官网文档](https://docs.docker.com/get-docker/)。
安装完毕后终端查看Docker版本是否正常输出。
```
$ docker -v
Docker version 20.10.12, build e91ed57
```
2. Docker安装VictoriaMetrics

```shell
$ docker run -d -p 8428:8428 \
-v $(pwd)/victoria-metrics-data:/victoria-metrics-data \
--name victoria-metrics \
victoriametrics/victoria-metrics:v1.95.1
```

`-v $(pwd)/victoria-metrics-data:/victoria-metrics-data` 为VictoriaMetrics数据目录本地持久化挂载
使用```$ docker ps```查看数据库是否启动成功

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

配置HertzBeat的配置文件
修改位于 `hertzbeat/config/application.yml` 的配置文件
注意⚠️docker容器方式需要将application.yml文件挂载到主机本地,安装包方式解压修改位于 `hertzbeat/config/application.yml` 即可

**修改里面的`warehouse.store.jpa.enabled`参数为`false`, 配置`warehouse.store.victoria-metrics`数据源参数,HOST账户密码等,并启用`enabled`为`true`**

```yaml
warehouse:
store:
# 关闭默认JPA
jpa:
enabled: false
# 启用 victoria-metrics
victoria-metrics:
enabled: true
url: http://localhost:8428
username: root
password: root
```

4. 重启 HertzBeat

### 常见问题

1. 时序数据库是否都需要配置,能不能都用
> 不需要都配置,任选其一即可,用enable参数控制其是否使用,也可都不安装配置,但会影响历史图表数据和存储时长等。

1 change: 1 addition & 0 deletions home/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"href": "https://artifacthub.io/packages/helm/hertzbeat/hertzbeat"
},
"start/upgrade",
"start/victoria-metrics-init",
"start/iotdb-init",
"start/tdengine-init",
"start/greptime-init",
Expand Down
2 changes: 2 additions & 0 deletions script/docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
## Docker-Compose Deploy

- Use Mysql + VictoriaMetrics as Hertzbeat dependent storage -> [HertzBeat+Mysql+VictoriaMetrics Solution](hertzbeat-mysql-victoria-metrics)
- Use Mysql + IoTDB as Hertzbeat dependent storage -> [HertzBeat+Mysql+IoTDB Solution](hertzbeat-mysql-iotdb)
- Use Mysql + Tdengine as Hertzbeat dependent storage -> [HertzBeat+Mysql+Tdengine Solution](hertzbeat-mysql-tdengine)
- Use Postgresql + IoTDB as Hertzbeat dependent storage -> [HertzBeat+PostgreSQL+IoTDB Solution](hertzbeat-postgresql-iotdb)


## Docker-Compose 部署方案

- 使用 Mysql + VictoriaMetrics 作为 Hertzbeat 依赖存储服务 -> [HertzBeat+Mysql+VictoriaMetrics 方案](hertzbeat-mysql-victoria-metrics)
- 使用 Mysql + IoTDB 作为 Hertzbeat 依赖存储服务 -> [HertzBeat+Mysql+IoTDB 方案](hertzbeat-mysql-iotdb)
- 使用 Mysql + Tdengine 作为 Hertzbeat 依赖存储服务 -> [HertzBeat+Mysql+Tdengine 方案](hertzbeat-mysql-tdengine)
- 使用 PostgreSQL + IoTDB 作为 Hertzbeat 依赖存储服务 -> [HertzBeat+PostgreSQL+IoTDB 方案](hertzbeat-postgresql-iotdb)
2 changes: 1 addition & 1 deletion script/docker-compose/hertzbeat-mysql-tdengine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
##### docker compose deploys hertzbeat and its dependent services

1. Download the hertzbeat-docker-compose installation deployment script file
The script file is located in `script/docker-compose/hertzbeat-mysql-tdengine` link [script/docker-compose](https://gitee.com/dromara/hertzbeat/tree/master/script/docker-compose/ hertzbeat-mysql-tdengine)
The script file is located in `script/docker-compose/hertzbeat-mysql-tdengine` link [script/docker-compose](https://gitee.com/dromara/hertzbeat/tree/master/script/docker-compose/hertzbeat-mysql-tdengine)


2. Enter the deployment script docker-compose directory, execute
Expand Down
28 changes: 28 additions & 0 deletions script/docker-compose/hertzbeat-mysql-victoria-metrics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Docker-Compose deployment HertzBeat+Mysql+VictoriaMetrics Solution

> The docker-compose deployment scheme uses Mysql + VictoriaMetrics as the dependent storage service of Hertzbeat.
> This solution will start three container services Mysql, VictoriaMetrics, HertzBeat

##### Install Docker & Docker-compose

1. Download and install docker environment & docker-compose environment
Please refer to [Docker official website documentation](https://docs.docker.com/get-docker/), [Compose installation](https://docs.docker.com/compose/install/)
```
$ docker -v
Docker version 20.10.12, build e91ed57
```

##### docker compose deploys hertzbeat and its dependent services

1. Download the hertzbeat-docker-compose installation deployment script file
The script file is located in `script/docker-compose/hertzbeat-mysql-victoria-metrics` link [script/docker-compose](https://gitee.com/dromara/hertzbeat/tree/master/script/docker-compose/hertzbeat-mysql-victoria-metrics)


2. Enter the deployment script docker-compose directory, execute

`docker compose up -d`


##### Start exploring HertzBeat

Browser access `localhost:1157` to start, the default account password `admin/hertzbeat`
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## docker-compose部署 HertzBeat+Mysql+VictoriaMetrics 方案

- 如果不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻 **[登录注册](https://console.tancloud.cn)** 免费使用。
- 如果想自己本地快速部署的话,可以参考下面进行操作。

> docker-compose 部署方案使用了 Mysql + VictoriaMetrics 作为 Hertzbeat 依赖存储服务。
> 此方案会启动三个容器服务 Mysql, VictoriaMetrics, HertzBeat

##### 安装Docker & Docker-compose

1. 下载安装 docker 环境 & docker-compose 环境
请参考 [Docker官网文档](https://docs.docker.com/get-docker/), [Compose安装](https://docs.docker.com/compose/install/)
```
$ docker -v
Docker version 20.10.12, build e91ed57
```

##### docker compose部署hertzbeat及其依赖服务

1. 下载hertzbeat-docker-compose安装部署脚本文件
脚本文件位于代码仓库下`script/docker-compose/hertzbeat-mysql-victoria-metrics` 链接 [script/docker-compose](https://gitee.com/dromara/hertzbeat/tree/master/script/docker-compose/hertzbeat-mysql-mysql-victoria-metrics)


2. 进入部署脚本 docker-compose 目录, 执行

`docker compose up -d`

##### 开始探索HertzBeat

浏览器访问 `localhost:1157` 即可开始,默认账号密码 `admin/hertzbeat`

---

怎么样是不是很简单,只要几分钟就可以部署完成,赶紧试试吧!
Loading
Loading