Use Apache Doris to Store Metrics and Logs Data (Optional)
Apache HertzBeat's historical data storage relies on the time series database, 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)
It is recommended to use Greptime as metrics storage.
Apache Doris is an MPP-based real-time analytics database. In HertzBeat, Doris can be used to store:
- Metrics history data (
hzb_history) - Log data (
hzb_log)
⚠️ If you do not configure a time-series database, only the last hour of historical data is retained.
If you already have a Doris cluster, skip directly to the YML configuration section.
Install Doris (Optional)
You can deploy Doris by package or Docker. For production, follow the official deployment guide:
- Doris docs: Quick Start
For HertzBeat integration, ensure at least:
- FE MySQL service port is reachable (default
9030) - FE HTTP service port is reachable (default
8030)
Note: Install MySQL JDBC Driver Jar
- Download MySQL JDBC driver jar, for example mysql-connector-java-8.1.0.jar. https://mvnrepository.com/artifact/com.mysql/mysql-connector-j/8.1.0
- Copy this jar to the
ext-libdirectory in HertzBeat installation directory. - Restart HertzBeat service.
Prerequisites
- Doris FE and BE are running normally.
- HertzBeat can access:
- FE MySQL port (default
9030) for metadata/query - FE HTTP port (default
8030) for Stream Load
- FE MySQL port (default
- The configured Doris user has permission to create database/table and insert/query data.
Configure Doris in HertzBeat application.yml
-
Edit
hertzbeat/config/application.yml.For Docker deployment, mount the config file from host. For package deployment, modify
hertzbeat/config/application.ymldirectly. -
Configure
warehouse.store.doris(Production Environment Recommended using Stream Load Mode):
warehouse:
store:
doris:
enabled: true
# FE MySQL endpoint
url: jdbc:mysql://127.0.0.1:9030
username: root
password:
table-config:
# Enable dynamic partition for automatic expiration
enable-partition: true
# HOUR / DAY / MONTH
partition-time-unit: DAY
# Number of history partitions to keep
partition-retention-days: 30
# Number of future partitions to pre-create
partition-future-days: 3
buckets: 8
replication-num: 3
pool-config:
minimum-idle: 5
maximum-pool-size: 20
connection-timeout: 30000
write-config:
# Strongly recommend stream mode in production for high throughput
write-mode: stream
batch-size: 1000
flush-interval: 5
stream-load-config:
# FE HTTP port
http-port: ":8030"
timeout: 60
max-bytes-per-batch: 10485760
# For complex networks (K8s/cross-domain): direct / public / private
redirect-policy: ""