Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Getting Started with IoTDB

Updated on 2024-10-25 GMT+08:00

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 can connect to 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.

Background

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:

  1. Create a storage group named root.Group name to represent the group.
  2. Create time series to store the device indicators.
  3. Simulate sensors and record indicators.
  4. Run SQL statements to query indicators.
  5. After the service is complete, delete the stored data.
Figure 1 Data structure

Procedure

  1. Log in to the client.

    1. Log in to the node where the client is installed as the client installation user and run the following command to switch to the client installation directory, for example, /opt/client.

      cd /opt/client

    2. Run the following command to configure environment variables:

      source bigdata_env

    3. Before logging in to the IoTDB client for the first time, perform the following steps to generate a client SSL certificate:
      1. Run the following command to generate a client SSL certificate:

        keytool -noprompt -import -alias myservercert -file ca.crt -keystore truststore.jks

        After running this command, you are required to set a password.

      2. Copy the generated truststore.jks file to the Client installation directory/IoTDB/iotdb/conf directory.

        cp truststore.jks Client installation directory/IoTDB/iotdb/conf

    4. If Kerberos authentication is enabled for the current cluster, run the following command to authenticate the current user. The current user must have the permission to create IoTDB tables. For details, see IoTDB User Permission Management. If Kerberos authentication is disabled for the current cluster, skip this step.

      kinit MRS cluster user

      Example:

      kinit iotdbuser

  2. Run the following command to switch to the directory where the script for running IoTDB client is stored:

    cd /opt/client/IoTDB/iotdb/sbin

  3. If Kerberos authentication is disabled for the cluster (the cluster is in normal mode), invoke the alter-cli-password.sh script to change the default password of the default user root.

    sh alter-cli-password.sh IP address of the IoTDBServer instance RPC port number

    NOTE:
    • To view the IP address of the IoTDBServer instance node, log in to FusionInsight Manager and choose Cluster > Services > IoTDB > Instances.
    • The IoTDBServer RPC port can be configured in the IoTDB_SERVER_RPC_PORT parameter. The default ports are as follows:
      • The default open-source port number is 6667.
      • The default customized port number is 22260.

      Port customization/open source: When creating an LTS version cluster, you can set Component Port to Open source or Custom. If Open source is selected, the open source port is used. If Custom is selected, the customized port is used.

    • The initial password of user root is root in versions earlier than MRS 3.3.0 and Iotdb@123 in MRS 3.3.3.0 and later versions.

      The password must contain at least four characters in versions earlier than MRS 3.3.0 and at least eight characters in MRS 3.3.0 and later versions, and cannot contain spaces.

  4. Run the following command to log in to the client:

    ./start-cli.sh -h IP address of the IoTDBServer instance node -p IoTDBServer RPC port

    The default IoTDBServer RPC can be configured in the IOTDB_SERVER_RPC_PORT parameter.

    After running this command, specify the service username as needed (user root is used for login when Kerberos authentication is disabled for the cluster (the cluster is in normal mode)).

    • To specify the service username, enter yes and enter the service username and password as prompted.

    • If you will not specify the service username, enter no. In this case, you will perform subsequent operations as the user in 1.d.

    • If you enter other information, you will log out.

  5. Create a storage group/database (MRS 3.3.0 and later versions) named root.company based on Figure 1.

    set storage group to root.company;

  6. Create corresponding time series for sensors of the devices on the production line.

    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;

  7. Adds data to time series.

    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);

  8. Query indicators of all devices on the production line 1.

    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|
    +-----------------------------+-------------------------------+---------------------------------+--------------------------------------+--------------------------------+

  9. Delete all device indicators on the production line 2.

    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.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback