IoTDB is a data management engine that integrates collection, storage, and analysis of time series data. It features lightweight, high performance, and ease of use. It perfectly interconnects with the Hadoop and Spark ecosystems and meets the requirements of high-speed write and complex analysis and query on massive time series data in industrial IoT applications.
Assume that a group has three production lines with five devices on each. Sensors collect indicators (such as temperature, speed, and running status) of these devices in real time, as shown in Figure 1. The service process of storing and managing data using IoTDB is as follows:
cd /opt/client
kinit MRS cluster user
Example:
kinit iotdbuser
cd /opt/client/IoTDB/iotdb/sbin
./start-cli.sh -h IP address of the IoTDBServer instance node -p IoTDBServer RPC port
The default IoTDBServer RPC port number is 22260, which can be configured in the rpc_port parameter.
After you run this command, specify the service username as required.
set storage group to root.company;
create timeseries root.company.line1.device1.spin WITH DATATYPE=FLOAT, ENCODING=RLE;
create timeseries root.company.line1.device1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN;
create timeseries root.company.line1.device2.temperature WITH DATATYPE=FLOAT, ENCODING=RLE;
create timeseries root.company.line1.device2.power WITH DATATYPE=FLOAT, ENCODING=RLE;
create timeseries root.company.line2.device1.temperature WITH DATATYPE=FLOAT, ENCODING=RLE;
create timeseries root.company.line2.device1.speed WITH DATATYPE=FLOAT, ENCODING=RLE;
create timeseries root.company.line2.device2.speed WITH DATATYPE=FLOAT, ENCODING=RLE;
create timeseries root.company.line2.device2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN;
insert into root.company.line1.device1(timestamp, spin) values (now(), 6684.0);
insert into root.company.line1.device1(timestamp, status) values (now(), false);
insert into root.company.line1.device2(timestamp, temperature) values (now(), 66.7);
insert into root.company.line1.device2(timestamp, power) values (now(), 996.4);
insert into root.company.line2.device1(timestamp, temperature) values (now(), 2684.0);
insert into root.company.line2.device1(timestamp, speed) values (now(), 120.23);
insert into root.company.line2.device2(timestamp, speed) values (now(), 130.56);
insert into root.company.line2.device2(timestamp, status) values (now(), false);
select * from root.company.line1.**;
+-----------------------------+-------------------------------+---------------------------------+--------------------------------------+--------------------------------+ | Time|root.company.line1.device1.spin|root.company.line1.device1.status|root.company.line1.device2.temperature|root.company.line1.device2.power| +-----------------------------+-------------------------------+---------------------------------+--------------------------------------+--------------------------------+ |2021-06-17T11:29:08.131+08:00| 6684.0| null| null| null| |2021-06-17T11:29:08.220+08:00| null| false| null| null| |2021-06-17T11:29:08.249+08:00| null| null| 66.7| null| |2021-06-17T11:29:08.282+08:00| null| null| null| 996.4| +-----------------------------+-------------------------------+---------------------------------+--------------------------------------+--------------------------------+
delete timeseries root.company.line2.*;
Query the indicator data on production line 2. The result shows no indicator data exists.
select * from root.company.line2.**;
+----+ |Time| +----+ +----+ Empty set.