Skip to content

Commit 3ed52c5

Browse files
authored
[doc] hertzbeat 1.6.0 upgrade guide (apache#2077)
1 parent c5808a0 commit 3ed52c5

File tree

2 files changed

+405
-0
lines changed

2 files changed

+405
-0
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# HertzBeat 1.6.0 Upgrade Guide
2+
3+
**Note: This guide is applicable for upgrading from versions prior to 1.6.0 to version 1.6.0.**
4+
5+
## Binary Installation Package Upgrade
6+
7+
### Upgrade Java Environment
8+
9+
Since version 1.6.0 uses Java 17 and the installation package no longer provides a built-in JDK version, use the new Hertzbeat according to the following situations:
10+
11+
- When the default environment variable on your server is Java 17, you do not need to take any action for this step.
12+
- When the default environment variable on your server is not Java 17, such as Java 8 or Java 11, and if there are no other applications on your server that require a lower version of Java, download the appropriate version from [https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) according to your system, and search the engine for how to set a new environment variable pointing to the new Java 17.
13+
- When the default environment variable on your server is not Java 17, such as Java 8 or Java 11, and if there are other applications on your server that require a lower version of Java, download the appropriate version from [https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) according to your system, and rename the extracted folder to `java`, then copy it to the Hertzbeat extraction directory.
14+
15+
### Upgrade Database
16+
17+
Go to [https://github.com/apache/hertzbeat/tree/master/manager/src/main/resources/db/migration](https://github.com/apache/hertzbeat/tree/master/manager/src/main/resources/db/migration), choose the directory of your database and execute the corresponding `V160__update_column.sql` file for the upgrade SQL.
18+
19+
### Upgrade Configuration Files
20+
21+
Due to significant changes in `application.yml` and `sureness.yml`, it is recommended to directly use the new `yml` configuration files and then modify them based on your own needs.
22+
23+
#### `application.yml` generally needs to modify the following parts:
24+
25+
Default is:
26+
```yaml
27+
datasource:
28+
driver-class-name: org.h2.Driver
29+
username: sa
30+
password: 123456
31+
url: jdbc:h2:./data/hertzbeat;MODE=MYSQL
32+
hikari:
33+
max-lifetime: 120000
34+
35+
jpa:
36+
show-sql: false
37+
database-platform: org.eclipse.persistence.platform.database.MySQLPlatform
38+
database: h2
39+
properties:
40+
eclipselink:
41+
logging:
42+
level: SEVERE
43+
```
44+
If you change to a MySQL database, here is an example:
45+
```yaml
46+
datasource:
47+
driver-class-name: com.mysql.cj.jdbc.Driver
48+
username: root
49+
password: root
50+
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
51+
hikari:
52+
max-lifetime: 120000
53+
54+
jpa:
55+
show-sql: false
56+
database-platform: org.eclipse.persistence.platform.database.MySQLPlatform
57+
database: mysql
58+
properties:
59+
eclipselink:
60+
logging:
61+
level: SEVERE
62+
```
63+
64+
#### `sureness.yml` modification is optional, usually when you need to change account passwords:
65+
66+
```yaml
67+
# account info config
68+
# eg: admin has role [admin,user], password is hertzbeat
69+
# eg: tom has role [user], password is hertzbeat
70+
# eg: lili has role [guest], plain password is lili, salt is 123, salted password is 1A676730B0C7F54654B0E09184448289
71+
account:
72+
- appId: admin
73+
credential: hertzbeat
74+
role: [admin]
75+
- appId: tom
76+
credential: hertzbeat
77+
role: [user]
78+
- appId: guest
79+
credential: hertzbeat
80+
role: [guest]
81+
- appId: lili
82+
# credential = MD5(password + salt)
83+
# plain password: hertzbeat
84+
# attention: digest authentication does not support salted encrypted password accounts
85+
credential: 94C6B34E7A199A9F9D4E1F208093B489
86+
salt: 123
87+
role: [user]
88+
```
89+
90+
### Add the corresponding database drivers
91+
92+
Due to the Apache Foundation's requirements for license compliance, HertzBeat's installation package cannot include dependencies with GPL licenses such as MySQL, Oracle, etc. Users need to add them themselves. Users can download the drivers from the following links and copy them to the `ext-lib` directory of the installation:
93+
94+
- MySQL: [https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.25.zip](https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.25.zip)
95+
- Oracle (If you want to monitor Oracle, these two drivers are required):
96+
- [https://download.oracle.com/otn-pub/otn_software/jdbc/234/ojdbc8.jar](https://download.oracle.com/otn-pub/otn_software/jdbc/234/ojdbc8.jar)
97+
- [https://repo.mavenlibs.com/maven/com/oracle/database/nls/orai18n/21.5.0.0/orai18n-21.5.0.0.jar](https://repo.mavenlibs.com/maven/com/oracle/database/nls/orai18n/21.5.0.0/orai18n-21.5.0.0.jar)
98+
99+
Next, run the start-up script as before to experience the latest HertzBeat 1.6.0!
100+
101+
## Docker Upgrade - Mysql Database
102+
103+
- Stop the HertzBeat container:
104+
```
105+
docker stop hertzbeat
106+
```
107+
108+
- Upgrade the database script:
109+
- Go to [https://github.com/apache/hertzbeat/tree/master/manager/src/main/resources/db/migration](https://github.com/apache/hertzbeat/tree/master/manager/src/main/resources/db/migration), choose the directory of your database and execute the corresponding `V160__update_column.sql` file in MySQL.
110+
111+
- Upgrade the configuration files:
112+
- As mentioned, due to significant changes in `application.yml` and `sureness.yml`, it is recommended to directly mount and use the new `yml` configuration files, and then modify them based on your own needs.
113+
114+
- Add the corresponding database drivers:
115+
- Due to the Apache Foundation's license compliance requirements, HertzBeat's installation package cannot include MySQL, Oracle, and other GPL-licensed dependencies. Users need to add them themselves by downloading the driver jars from the above links and placing them in the local `ext-lib` directory, then mounting `ext-lib` to the container's `/opt/hertzbeat/ext-lib` directory when starting.
116+
117+
Next, run HertzBeat using Docker as before to experience the latest HertzBeat 1.6.0!
118+
119+
## Docker Installation Upgrade - H2 Built-in Database (Not recommended for production use)
120+
121+
- Stop the HertzBeat container:
122+
```
123+
docker stop hertzbeat
124+
```
125+
126+
- Edit the H2 database files:
127+
- Assuming you have mounted the H2 database files in the `data` directory to the local system, or copied the `/opt/hertzbeat/data` directory from the old container manually.
128+
- Download the H2 driver jar from [https://mvnrepository.com/artifact/com.h2database/h2/2.2.220](https://mvnrepository.com/artifact/com.h2database/h2/2.2.220).
129+
- Start the database locally using the H2 driver jar:
130+
```
131+
java -jar h2-2.2.220.jar -url jdbc:h2:file:./hertzbeat -user sa -password 123456
132+
```
133+
134+
- Upgrade the configuration files:
135+
- As mentioned, due to significant changes in `application.yml` and `sureness.yml`, it is recommended to directly mount and use the new `yml` configuration files, and then modify them based on your own needs.
136+
137+
- Add the corresponding database drivers:
138+
- As mentioned, due to the Apache Foundation's license compliance requirements, HertzBeat's installation package cannot include MySQL, Oracle, and other GPL-licensed dependencies. Users need to add them themselves by downloading the driver jars from the above links and placing them in the local `ext-lib` directory, then mounting `ext-lib` to the container's `/opt/hertzbeat/ext-lib` directory when starting.
139+
140+
Next, run the Docker to start HertzBeat as before to experience the latest HertzBeat 1.6.0!
141+
142+
## Upgrade via Export and Import
143+
144+
If you do not want to go through the tedious script upgrade method mentioned above, you can directly export and import the monitoring tasks and threshold information from the old environment.
145+
146+
- Deploy a new environment with the latest version.
147+
- Export the monitoring tasks and threshold information from the old environment on the page

0 commit comments

Comments
 (0)