Typical application scenarios
In a provincial meteorological warning system, the hourly rainfall data of the rainfall station is synchronized to the data center through the MQTT protocol, the data is received through the extension of HiveMQ, and the data is stored through the TDengine rest interface and jdbc interface. (System run environment Docker, development environment window 10) First. Basic environment software
1 HiveMQ 4.4.1
2 TDengine Server Linux 2.0.4.0, TDengine client Linux 2.0.4.0
3 Docker Engine v19.03.12
4 MQTTX 1.3.1 debugging tool, MQTTLoader stress test tool
5 IDEA 2019.2 development tools, JAVA JDK 11
second. Brief introduction of source code structure
--java.com
----common (configuration file analysis)
----hivemq (extension HiveMQ )
----tdengine (time-series database )
------jdbc
------rest
Special Note
1, runtime.properties STYPE = db, direct JDBC write To tdengine, STYPE = rest, call tdengine rest interface to write To tdengine 2. HiveMQ passes the user password security authentication test_name_1, password_1
Three, system deployment
-
TDengine container deployment
1.1 Download the mirror, the latest version 2.0.4.0
docker pull tdengine/tdengine
1.2 Start the container
Map configuration files, logs, data files, and extensions to the host host directory.
docker run -d --name tdengine2.0.4 -v E:\taos\etc:/etc/taos -v E:\taos\data:/var/lib/taos -v E:\taos\logs:/var/ log/taos --hostname 144td -p 6030:6030 -p 6035:6035 -p 6041:6041 -p 6030-6040:6030-6040/udp tdengine/tdengine
1.3 Create database, super table
create database if not exists rainstation KEEP 7665 DAYS 120 BLOCKS 30;
create table if not exists rainstation.monitoring(ts timestamp, rainfall float) TAGS (station_code BINARY(10), station_name NCHAR(20), station_type BINARY(2));
Second. HiveMQ container deployment
1 Download image
docker pull hivmemq/hivmemq
2 Start the container
HiveMQ container deployment, mapping data files, logs, and extensions to the host host directory.
docker run --name hivemq4 -v E:\hivemq\log:/opt/hivemq/log -v E:\hivemq\data:/opt/hivemq/data -v E:\hivemq\extensions:/opt/hivemq/ extensions -p 8080:8080 -p 1883:1883 -p 8083:8083 hivemq/hivemq4
3 Install TDengine client 2.0.4.0 client in docker
Four, extension deployment
1 HiveMQ extension program, support rest interface, jdbc interface storage. MAVEN packaging zip,
2 Unzip the compressed package and place it in the extensions directory mapped to the host host
Five, start the container Manage containers directly in the Docker client.