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 the missing parts of docs, fix layout, sync the English version with the Chinese version #2048

Merged
merged 5 commits into from
May 30, 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
60 changes: 36 additions & 24 deletions home/docs/start/mysql-change.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ MYSQL is a reliable relational database. In addition to default built-in H2 data

### Install MYSQL via Docker
1. Download and install the 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.
For Docker installation, please refer to the [Docker official documentation](https://docs.docker.com/get-docker/).
After the installation, please verify in the terminal that the Docker version can be printed normally.
```
$ docker -v
Docker version 20.10.12, build e91ed57
```
2. Install MYSQl with Docker
```
$ docker run -d --name mysql -p 3306:3306 -v /opt/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
$ docker run -d --name mysql \
-p 3306:3306 \
-v /opt/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
--restart=always \
mysql:5.7
```
`-v /opt/data:/var/lib/mysql` is local persistent mount of mysql data directory. `/opt/data` should be replaced with the actual local directory.
use ```$ docker ps``` to check if the database started successfully
Expand All @@ -32,26 +37,33 @@ MYSQL is a reliable relational database. In addition to default built-in H2 data

### Modify hertzbeat's configuration file application.yml and switch data source

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`
Replace `spring.database` data source parameters, URL account and password.
```yaml
spring:
datasource:
driver-class-name: org.h2.Driver
username: sa
password: 123456
url: jdbc:h2:./data/hertzbeat;MODE=MYSQL
```
Specific replacement parameters are as follows and you need to configure account according to the mysql environment:
```yaml
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 123456
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
```
- 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`
Replace `spring.database` data source parameters, URL account and password.

For example:
```yaml
spring:
datasource:
driver-class-name: org.h2.Driver
username: sa
password: 123456
url: jdbc:h2:./data/hertzbeat;MODE=MYSQL
```
Specific replacement parameters are as follows and you need to configure account according to the mysql environment:
```yaml
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 123456
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
platform: mysql
jpa:
database: mysql
```

- It is recommended to set the host field in the MySQL URL or Redis URL to the public IP address when using Hertzbeat in docker.

**Start HertzBeat visit http://ip:1157/ on the browser You can use HertzBeat monitoring alarm, default account and password are admin/hertzbeat**
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ MYSQL是一款值得信赖的关系型数据库,Apache HertzBeat (incubating)
### 通过Docker方式安装MYSQL
1. 下载安装Docker环境
Docker 工具自身的下载请参考 [Docker官网文档](https://docs.docker.com/get-docker/)
安装完毕后终端查看Docker版本是否正常输出
Docker 的安装请参考 [Docker官网文档](https://docs.docker.com/get-docker/)
安装完毕后请于终端检查Docker版本输出是否正常
```
$ docker -v
Docker version 20.10.12, build e91ed57
Expand All @@ -39,33 +39,35 @@ MYSQL是一款值得信赖的关系型数据库,Apache HertzBeat (incubating)

### 修改hertzbeat的配置文件application.yml切换数据源

1. 配置HertzBeat的配置文件
修改位于 `hertzbeat/config/application.yml` 的配置文件
注意⚠️docker容器方式需要将application.yml文件挂载到主机本地,安装包方式解压修改位于 `hertzbeat/config/application.yml` 即可
替换里面的`spring.database`数据源参数,IP端口账户密码驱动
⚠️注意`application.yml`文件内容需完整,除下方修改内容外其他参数需保留,完整内容见[/script/application.yml](https://github.com/hertzbeat/hertzbeat/raw/master/script/application.yml)

需修改部分原参数:
```yaml
spring:
datasource:
driver-class-name: org.h2.Driver
username: sa
password: 123456
url: jdbc:h2:./data/hertzbeat;MODE=MYSQL
```
具体替换参数如下,需根据mysql环境配置账户密码IP:
```yaml
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 123456
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
```
- 配置HertzBeat的配置文件
修改位于 `hertzbeat/config/application.yml` 的配置文件
注意⚠️docker容器方式需要将application.yml文件挂载到主机本地,安装包方式解压修改位于 `hertzbeat/config/application.yml` 即可
替换里面的`spring.database`数据源参数,IP端口账户密码驱动
⚠️注意`application.yml`文件内容需完整,除下方修改内容外其他参数需保留,完整内容见[/script/application.yml](https://github.com/hertzbeat/hertzbeat/raw/master/script/application.yml)

2. 通过docker启动时,需要修改host为宿主机的外网Ip,包括mysql连接字符串和redis。
需修改部分原参数:
```yaml
spring:
datasource:
driver-class-name: org.h2.Driver
username: sa
password: 123456
url: jdbc:h2:./data/hertzbeat;MODE=MYSQL
```
具体替换参数如下,需根据mysql环境配置账户密码IP:
```yaml
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 123456
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
platform: mysql
jpa:
database: mysql
```
- 通过docker启动时,建议修改host为宿主机的外网IP地址,包括mysql连接字符串和redis。
**启动 HertzBeat 浏览器访问 http://ip:1157/ 开始使用HertzBeat进行监控告警,默认账户密码 admin/hertzbeat**
Expand Down
Loading