Time-Series Database
Prerequisites
- Docker is installed, and the bridge network for inter-container communication exists:
docker network create -d bridge fastbee-bridge - You have chosen one time-series storage based on data volume: MySQL works for small volumes; for large volumes choose one of TDengine, InfluxDB, or IoTDB — they cannot be enabled at the same time.
- You have recorded the connection address, port, account, and password of the chosen database; they are required in the enablement configuration.
- For TDengine, the server, client, and client driver versions must match.
Enabling a Time-Series Database
The system currently supports four time-series data storage methods: mysql, tdengine, influxdb, and iotdb. Small data volumes can be stored in mysql; for large volumes, choose one of tdengine, influxdb, or iotdb as needed — they cannot be enabled at the same time. The application-sql configuration file contains configuration examples for the three time-series databases. In the development or production environment, copy the configuration of the corresponding time-series database from the application-sql file into application-dev or application-prod, and change enable to true to enable it. The corresponding time-series database must be installed before enabling; see the installation steps for each database below.


Installing on an Operating System
There are plenty of similar tutorials and documents, and Windows and Linux have different installation methods, so they are not covered in detail here. The Docker-based installation is mainly introduced below.
Docker Installation
提示
Before running the container, if there is no bridge network, create one first for inter-container communication: docker network create -d bridge fastbee-bridge
1. TDengine Installation
Run the following command to install TDengine; the hostname is set for client connections.
docker run -d \
--name tdengine \
--hostname="fastbee" \
--volume /var/data/taos/log:/var/log/taos \
--volume /var/data/taos/data:/var/lib/taos \
--publish 6030-6049:6030-6049 \
--publish 6030-6049:6030-6049/udp \
--restart unless-stopped \
--volume /etc/localtime:/etc/localtime \
--env "TZ=Asia/Shanghai" \
tdengine/tdengine:3.3.2.0About TDengine
警告
- The server, client, and client driver versions must match.
- The system uses MySQL by default to store device-reported data; for large data volumes, TDengine storage can be enabled.
The TDengine Community Edition is an open-source version under the AGPL license, and it is a platform for processing small and medium-scale IoT data. It provides all the capabilities needed to process IoT data efficiently, including:
- A SQL-like query language to insert or query data
- Development interfaces such as C/C++, Java (JDBC), Python, Go, RESTful, and Node.JS
- Ad hoc query and analysis through the TDengine Shell or Python/R/Matlab
- Stream computing based on sliding windows through continuous queries
- Super tables, which make data aggregation across devices simple and flexible through tags
- A built-in message queue, so applications can subscribe to the latest data
- A built-in caching mechanism, so the latest state or record of each device is quickly available
- No distinction between historical and real-time data — transparent and identical to applications
- A distributed architecture with linear scalability, so any data volume can be handled
- Multi-replica support with no single point of failure, ensuring high availability and reliability
Enabling TDengine in the System
提示
- If TDengine is installed on a server while the project runs locally, the client driver must be installed first. View details
- After installing TDengine, FQDN must be configured for remote client connections. Reference document
- JDBCDriver cannot find the dynamic link library on Windows. Solution
- Modify the configuration file, located at:
springboot/fastbee-admin/src/main/resources/application-dev.yml; for production, useapplication-prod.yml
taos: # Configure the taos data source
enabled: false # TDengine is disabled by default; true=enabled, false=disabled
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.taosdata.jdbc.TSDBDriver
url: jdbc:TAOS://fastbee:6030/fastbee_log?timezone=UTC-8&charset=utf-8
username: root
password: taosdata
dbName: fastbee_log- Start the project. If TDengine is connected correctly, the
fastbee_logdatabase and thedevice_logsuper table are created automatically; after devices report data, subtables nameddevice_<device-number>are created automatically.
Connecting to TDengine Remotely with Client Tools
提示
- hostname — the host name; in a LAN, the host name can also be resolved to an IP (server-side setting)
- hosts — the local DNS system; domain queries check this file first and only query the DNS server when no match is found (client-side setting)
TDengine uses an FQDN (usually the hostname) as the node ID. To ensure normal operation, configure the FQDN on the server running taosd, and configure DNS or the hosts file on the machine running the TDengine CLI or the application, so the FQDN can be resolved. An FQDN (fully qualified domain name) is the complete domain name of a computer or host, consisting of the host name and the domain name. DNS translates FQDNs into IPs and is the addressing method used by the vast majority of Internet applications.
- Linux server and client setup
- Change the content of the
/etc/hostnamefile tofastbee; a restart is required for this to take effect, or run thehostname fastbeecommand - Edit the
/etc/hostsfile and append10.211.55.14 fastbeeat the end; fill in the IP according to your own server
- Windows currently only supports deploying the client
- Edit the hosts file in the
C:\Windows\System32\drivers\etcdirectory and append10.211.55.14 fastbeeat the end; fill in the IP according to your own server
- Client tool download: TDengineGUI
2. InfluxDB Installation
Run the following command to install InfluxDB; the bridge network must be created first: docker network create -d bridge fastbee-bridge
docker run -d \
--name influxdb \
-p 8086:8086 \
-v /var/data/influxdb2:/var/lib/influxdb2 \
-e DOCKER_INFLUXDB_INIT_MODE="setup" \
-e DOCKER_INFLUXDB_INIT_USERNAME="admin" \
-e DOCKER_INFLUXDB_INIT_PASSWORD="admin123" \
-e DOCKER_INFLUXDB_INIT_ORG="fastbee" \
-e DOCKER_INFLUXDB_INIT_BUCKET="device_log" \
-e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN="inX0k-IPfSgKg6AIfoZm6Mv0DQyQOKCkfvs5ZF3a836Yzx2Ew9QgxsHev40_2gztuMn6tofwyS6nfbT4cD-SeA==" \
--network fastbee-bridge \
influxdb:2.7.5InfluxDB 2.x comes with a built-in visualization tool. The command above automatically creates the login account admin with password admin123, ORG fastbee, the bucket (equivalent to a table) device_log, and an access TOKEN. Access the InfluxDB console via ip:8086: 
Log in with admin / admin123 to see the following page: 
3. IoTDB Installation
Run the following command to install IoTDB; the bridge network must be created first: docker network create -d bridge fastbee-bridge
docker run -d \
--name iotdb \
--restart always \
-p 6667:6667 \
-p 5555:5555 \
-p 8070:8070 \
-p 9003:9003 \
--privileged \
-v /var/data/iotdb/data:/iotdb/data \
-v /var/data/iotdb/logs:/iotdb/logs \
-v /var/data/iotdb/conf:/iotdb/conf \
-e TZ=Asia/Shanghai \
--network fastbee-bridge \
apache/iotdb:1.3.3-standaloneAfter IoTDB is installed, the SQL that creates the time-series fields must be executed before it can be enabled. The steps are as follows:
1. Configure the IoTDB Database Connection Driver in the IDEA Development Tool (or Another Tool)
The driver location is as follows:
The configuration is as follows: 

Configure the data source: 
After configuration, right-click to create a new query console.
Find the IoTDB initialization SQL and copy the SQL that creates the time series into the console to execute it.
Once execution succeeds, the IoTDB time-series database can be enabled. 
Verifying the Enablement
- After modifying the configuration and restarting the backend, the startup log contains no data source connection errors.
- TDengine: once connected correctly, the
fastbee_logdatabase and thedevice_logsuper table are created automatically; after devices report data, subtables nameddevice_<device-number>are created automatically. - InfluxDB: log in to the console at
ip:8086and confirm new data is written to thedevice_logbucket after devices report data. - IoTDB: confirm the initialization SQL has been executed successfully, and time-series data can be queried after devices report data.
- Query device history data on the platform pages and confirm it displays correctly.
Troubleshooting
| Issue | Possible Cause | Solution |
|---|---|---|
| Backend startup reports TDengine connection failure | FQDN not resolved or client driver not installed | Configure FQDN/hosts as described above, and install the client driver matching the server version |
| JDBCDriver cannot find the dynamic link library on Windows | Client driver not installed | Install the TDengine client driver using the link above |
| Cannot log in to the InfluxDB console | Wrong initialization account or TOKEN | Check the initialization account, password, and TOKEN in the container environment variables |
| IoTDB write errors after enablement | The initialization SQL that creates the time-series fields was not executed | Execute the initialization SQL in the query console first, then enable |
| Enablement has no effect | The wrong environment configuration file was modified | Confirm you modified application-dev.yml or application-prod.yml matching the current environment |
| Multiple time-series databases enabled at once | Configuration conflict | Keep enabled set to true for only one time-series storage |


