Skip to content

Commit

Permalink
[monitor]change default database mysql to h2 (#191)
Browse files Browse the repository at this point in the history
  [monitor]change default database mysql to h2

  Add @wyt199905 as a contributor

  Add @weifuqing as a contributor

  Add @zklmcookle as a contributor

  Update @ChineseTony as a contributor

  [monitor]update config

  [docs]update config doc

  [home]update docs
  • Loading branch information
tomsun28 committed Jun 19, 2022
1 parent 63533f3 commit bfe34dd
Show file tree
Hide file tree
Showing 35 changed files with 442 additions and 256 deletions.
29 changes: 29 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,35 @@
"name": "ChineseTony",
"avatar_url": "https://avatars.githubusercontent.com/u/24618786?v=4",
"profile": "https://github.com/ChineseTony",
"contributions": [
"code",
"bug"
]
},
{
"login": "wyt199905",
"name": "wyt199905",
"avatar_url": "https://avatars.githubusercontent.com/u/85098809?v=4",
"profile": "https://github.com/wyt199905",
"contributions": [
"code"
]
},
{
"login": "weifuqing",
"name": "卫傅庆",
"avatar_url": "https://avatars.githubusercontent.com/u/13931013?v=4",
"profile": "https://github.com/weifuqing",
"contributions": [
"code",
"bug"
]
},
{
"login": "zklmcookle",
"name": "zklmcookle",
"avatar_url": "https://avatars.githubusercontent.com/u/107192352?v=4",
"profile": "https://github.com/zklmcookle",
"contributions": [
"code"
]
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,10 @@ node_modules
.docusaurus
yarn.lock

# h2 data
*.mv.db
*.trace.db

# debug env
application-dev.yml
application-dev.yml
application-mysql.yml
48 changes: 20 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,32 @@ Running HertzBeat in [OSCR.COM](https://osrc.com) Open Source Runtime Community
## 🐕 Quick Start

- If you don’t want to deploy but use it directly, we provide [SAAS Monitoring Cloud-TanCloud](https://console.tancloud.cn), **[Log In And Register For Free](https://console.tancloud.cn)**.
- If you want to deploy HertzBeat local, please refer to the following [Deployment Documentation](https://hertzbeat.com/docs/start/quickstart) for operation.

### 🐵 Dependency Service Deployment

> HertzBeat depends at least on relational database [MYSQL5+](https://www.mysql.com/) and time series database [TDengine2+](https://www.taosdata.com/getting-started)
##### Install MYSQL
1. Install mysql with docker
`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7`
2. Create database names `hertzbeat`
3. Run the database sql script [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql) located in the project repository `/script/sql/` directory.

For detailed steps, refer to [MYSQL Install And Init](https://hertzbeat.com/docs/start/mysql-init)

##### Install TDengine
1. Install TDengine with docker
`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine:2.4.0.12`
2. Create database names `hertzbeat`

For detailed steps, refer to [TDengine Install And Init](https://hertzbeat.com/docs/start/tdengine-init).
- If you want to deploy HertzBeat local, please refer to the following Deployment Documentation for operation.

### 🍞 Install HertzBeat

> HertzBeat supports installation through source code, docker or package.
> HertzBeat supports installation through source code, docker or package, cpu support X86/ARM64.
##### 1:Install quickly via docker
`docker run -d -p 1157:1157 -v /opt/application.yml:/opt/hertzbeat/config/application.yml --name hertzbeat tancloud/hertzbeat:[version]`

Detailed steps refer to [Install HertzBeat via Docker](https://hertzbeat.com/docs/start/docker-deploy)
1. Just one command to get started: `docker run -d -p 1157:1157 -name hertzbeat tancloud/hertzbeat`

2. Access `localhost:1157` to start, default account: `admin/hertzbeat`

Detailed config refer to [Install HertzBeat via Docker](https://hertzbeat.com/docs/start/docker-deploy)

##### 2:Install via package

1. Download the installation package [GITEE Release](https://gitee.com/dromara/hertzbeat/releases) [GITHUB Release](https://github.com/dromara/hertzbeat/releases)
2. Configure the HertzBeat configuration yml file `hertzbeat/config/application.yml`
3. Run shell `$ ./startup.sh `
4. Access `localhost:1157` to start, default account: `admin/hertzbeat`
2. Need Jdk Environment, `jdk8 -- jdk11`
3. [optional]Configure the HertzBeat configuration yml file `hertzbeat/config/application.yml`
4. Run shell `$ ./startup.sh `
5. Access `localhost:1157` to start, default account: `admin/hertzbeat`

Detailed steps refer to [Install HertzBeat via Package](https://hertzbeat.com/docs/start/package-deploy)
Detailed config refer to [Install HertzBeat via Package](https://hertzbeat.com/docs/start/package-deploy)

##### 3:Start via source code

1. Local source code debugging needs to start the back-end project manager and the front-end project web-app.
2. Backend:need `maven3+`, `java8+`, `lombok`, start the manager service.
3. Web:need `nodejs npm angular-cli` environment, Run `ng serve --open` in `web-app` directory after backend startup.
Expand Down Expand Up @@ -128,7 +115,12 @@ Thanks these wonderful people, welcome to join us:
<td align="center"><a href="https://github.com/brave4Time"><img src="https://avatars.githubusercontent.com/u/105094014?v=4?s=100" width="100px;" alt=""/><br /><sub><b>brave4Time</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=brave4Time" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3Abrave4Time" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/walkerlee-lab"><img src="https://avatars.githubusercontent.com/u/8426753?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WalkerLee</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=walkerlee-lab" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3Awalkerlee-lab" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/fullofjoy"><img src="https://avatars.githubusercontent.com/u/30247571?v=4?s=100" width="100px;" alt=""/><br /><sub><b>jianghang</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=fullofjoy" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3Afullofjoy" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/ChineseTony"><img src="https://avatars.githubusercontent.com/u/24618786?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ChineseTony</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=ChineseTony" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/ChineseTony"><img src="https://avatars.githubusercontent.com/u/24618786?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ChineseTony</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=ChineseTony" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3AChineseTony" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/wyt199905"><img src="https://avatars.githubusercontent.com/u/85098809?v=4?s=100" width="100px;" alt=""/><br /><sub><b>wyt199905</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=wyt199905" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/weifuqing"><img src="https://avatars.githubusercontent.com/u/13931013?v=4?s=100" width="100px;" alt=""/><br /><sub><b>卫傅庆</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=weifuqing" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3Aweifuqing" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/zklmcookle"><img src="https://avatars.githubusercontent.com/u/107192352?v=4?s=100" width="100px;" alt=""/><br /><sub><b>zklmcookle</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=zklmcookle" title="Code">💻</a></td>
</tr>
</table>

Expand Down
64 changes: 28 additions & 36 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,58 +50,45 @@
## 🐕 快速开始

- 如果您不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻 **[登录注册](https://console.tancloud.cn)** 免费使用。
- 如果您是想将HertzBeat部署到内网环境搭建监控系统,请参考下面的 [部署文档](https://hertzbeat.com/docs/start/quickstart) 进行操作
- 如果您是想将HertzBeat部署到内网环境搭建监控系统,请参考下面的部署文档进行操作

安装部署视频教程: [HertzBeat安装部署-BiliBili](https://www.bilibili.com/video/BV1GY41177YL)

### 🐵 依赖服务部署

> HertzBeat最少依赖于 关系型数据库[MYSQL5+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started)
##### 安装MYSQL
1. docker安装MYSQl
`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7`
2. 创建名称为hertzbeat的数据库
3. 执行位于项目仓库/script/sql/目录下的数据库脚本 [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql)
### 🍞 HertzBeat安装
> HertzBeat支持通过源码安装启动,Docker容器运行和安装包方式安装部署,CPU架构支持X86/ARM64。
详细步骤参考 [依赖服务MYSQL安装初始化](https://hertzbeat.com/docs/start/mysql-init)
##### 方式一:Docker方式快速安装

##### 安装TDengine
1. docker安装TDengine
`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine:2.4.0.12`
2. 创建名称为hertzbeat的数据库
1. `docker` 环境仅需一条命令即可开始

详细步骤参考 [依赖服务TDengine安装初始化](https://hertzbeat.com/docs/start/tdengine-init)
`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat`

### 🍞 HertzBeat安装
> HertzBeat支持通过源码安装启动,Docker容器运行和安装包方式安装部署。
2. 浏览器访问 `localhost:1157` 即可开始,默认账号密码 `admin/hertzbeat`

##### 方式一:Docker方式快速安装
`docker run -d -p 1157:1157 -v /opt/application.yml:/opt/hertzbeat/config/application.yml --name hertzbeat tancloud/hertzbeat:[版本tag]`

详细步骤参考 [通过Docker方式安装HertzBeat](https://hertzbeat.com/docs/start/docker-deploy)
更多配置详细步骤参考 [通过Docker方式安装HertzBeat](https://hertzbeat.com/docs/start/docker-deploy)

##### 方式二:通过安装包安装
1. 下载您系统环境对应的安装包 [GITEE Release](https://gitee.com/dromara/hertzbeat/releases) [GITHUB Release](https://github.com/dromara/hertzbeat/releases)
2. 配置HertzBeat的配置文件 hertzbeat/config/application.yml
3. 部署启动 `$ ./startup.sh `
4. 浏览器访问 localhost:1157 即可开始,默认账号密码 admin/hertzbeat
2. 需要已安装java环境, `jdk8 -- jdk11`
3. [可选]配置 HertzBeat 的配置文件 `hertzbeat/config/application.yml`
4. 部署启动 `$ ./startup.sh `
5. 浏览器访问 `localhost:1157` 即可开始,默认账号密码 `admin/hertzbeat`

详细步骤参考 [通过安装包安装HertzBeat](https://hertzbeat.com/docs/start/package-deploy)
更多配置详细步骤参考 [通过安装包安装HertzBeat](https://hertzbeat.com/docs/start/package-deploy)

##### 方式三:本地代码启动
1. 此为前后端分离项目,本地代码调试需要分别启动后端工程manager和前端工程web-app
2. 后端:需要`maven3+``java8+`环境,修改YML配置信息并启动manager服务
3. 前端:需要`nodejs npm angular-cli`环境,待本地后端启动后,在web-app目录下启动 `ng serve --open`
4. 浏览器访问 localhost:4200 即可开始,默认账号密码 admin/hertzbeat
##### 方式三:本地代码启动
1. 此为前后端分离项目,本地代码调试需要分别启动后端工程manager和前端工程web-app
2. 后端:需要`maven3+`, `java8+``lombok`环境,修改YML配置信息并启动manager服务
3. 前端:需要`nodejs npm angular-cli`环境,待本地后端启动后,在web-app目录下启动 `ng serve --open`
4. 浏览器访问 `localhost:4200` 即可开始,默认账号密码 `admin/hertzbeat`

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

##### 方式四:Docker-compose统一安装hertzbeat及其依赖服务
##### 方式四:Docker-compose统一安装hertzbeat及其依赖服务

通过 [docker-compose部署脚本](script/docker-compose) 一次性把mysql数据库,tdengine数据库和hertzbeat安装部署。
通过 [docker-compose部署脚本](script/docker-compose) 一次性把mysql数据库,tdengine数据库和hertzbeat安装部署。

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

**HAVE FUN**

Expand All @@ -128,7 +115,12 @@ Thanks these wonderful people, welcome to join us:
<td align="center"><a href="https://github.com/brave4Time"><img src="https://avatars.githubusercontent.com/u/105094014?v=4?s=100" width="100px;" alt=""/><br /><sub><b>brave4Time</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=brave4Time" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3Abrave4Time" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/walkerlee-lab"><img src="https://avatars.githubusercontent.com/u/8426753?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WalkerLee</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=walkerlee-lab" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3Awalkerlee-lab" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/fullofjoy"><img src="https://avatars.githubusercontent.com/u/30247571?v=4?s=100" width="100px;" alt=""/><br /><sub><b>jianghang</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=fullofjoy" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3Afullofjoy" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/ChineseTony"><img src="https://avatars.githubusercontent.com/u/24618786?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ChineseTony</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=ChineseTony" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/ChineseTony"><img src="https://avatars.githubusercontent.com/u/24618786?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ChineseTony</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=ChineseTony" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3AChineseTony" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/wyt199905"><img src="https://avatars.githubusercontent.com/u/85098809?v=4?s=100" width="100px;" alt=""/><br /><sub><b>wyt199905</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=wyt199905" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/weifuqing"><img src="https://avatars.githubusercontent.com/u/13931013?v=4?s=100" width="100px;" alt=""/><br /><sub><b>卫傅庆</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=weifuqing" title="Code">💻</a> <a href="https://github.com/tomsun28/hertzbeat/issues?q=author%3Aweifuqing" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/zklmcookle"><img src="https://avatars.githubusercontent.com/u/107192352?v=4?s=100" width="100px;" alt=""/><br /><sub><b>zklmcookle</b></sub></a><br /><a href="https://github.com/tomsun28/hertzbeat/commits?author=zklmcookle" title="Code">💻</a></td>
</tr>
</table>

Expand Down
12 changes: 10 additions & 2 deletions common/src/main/java/com/usthe/common/entity/alerter/Alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.Max;
Expand All @@ -32,6 +37,7 @@
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "Alarm record entity | 告警记录实体")
@EntityListeners(AuditingEntityListener.class)
public class Alert {

@Id
Expand Down Expand Up @@ -100,19 +106,21 @@ public class Alert {
private Map<String, String> tags;

@ApiModelProperty(value = "此条记录创建者", example = "tom", accessMode = READ_ONLY, position = 12)
@CreatedBy
private String creator;

@ApiModelProperty(value = "此条记录最新修改者", example = "tom", accessMode = READ_ONLY, position = 13)
@LastModifiedBy
private String modifier;

@ApiModelProperty(value = "Record the latest creation time (timestamp in milliseconds)",
notes = "记录最新创建时间(毫秒时间戳)",
example = "1612198922000", accessMode = READ_ONLY, position = 14)
@Column(insertable = false, updatable = false)
@CreatedDate
private LocalDateTime gmtCreate;

@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 15)
@Column(insertable = false, updatable = false)
@LastModifiedDate
private LocalDateTime gmtUpdate;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
Expand All @@ -34,7 +34,8 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "告警定义实体")
@ApiModel(description = "Alert Define | 告警定义实体")
@EntityListeners(AuditingEntityListener.class)
public class AlertDefine {

@Id
Expand Down Expand Up @@ -83,30 +84,20 @@ public class AlertDefine {
@Length(max = 1024)
private String template;

/**
* 此条记录创建者
*/
@ApiModelProperty(value = "此条记录创建者", example = "tom", accessMode = READ_ONLY, position = 11)
@CreatedBy
private String creator;

/**
* 此条记录最新修改者
*/
@ApiModelProperty(value = "此条记录最新修改者", example = "tom", accessMode = READ_ONLY, position = 12)
@LastModifiedBy
private String modifier;

/**
* 记录创建时间
*/
@ApiModelProperty(value = "记录创建时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 13)
@Column(insertable = false, updatable = false)
@CreatedDate
private LocalDateTime gmtCreate;

/**
* 记录最新修改时间
*/
@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 14)
@Column(insertable = false, updatable = false)
@LastModifiedDate
private LocalDateTime gmtUpdate;

}
Loading

0 comments on commit bfe34dd

Please sign in to comment.