[fly-iot Feifan IoT] (15): The IOT project uses the TDengine database to conduct technical research. It is successfully started locally using docker, and python can be used to insert connection data.

Preface


The original link of this article is:
https://blog.csdn.net/freewebsys/article/details/108971807
fly-iot column:
https://blog.csdn.net/freewebsys/category_12219758.html

1. Video demonstration address


2. About TDengine


Product Introduction
TDengine is a big data platform designed and optimized for scenarios such as the Internet of Things and the Industrial Internet. It can safely and efficiently aggregate, store, and store up to TB or even PB-level data generated every day by a large number of devices and data collectors. Analysis and distribution, real-time monitoring and early warning of business operation status, and providing real-time business insights. Its core module is the high-performance, clustered open source, cloud-native, minimalist time series database TDengine OSS.

This section introduces the main products and functions, competitive advantages, applicable scenarios, comparative tests with other databases, etc. of TDengine OSS, so that everyone can have an overall understanding of TDengine OSS.

https://docs.taosdata.com/intro/

2. Start the database tdengine service

Put it in the iot project and use docker-compose to start:

....

############### tdengine 时间序列数据库 ###############
  tdengine:
    restart: always
    image: tdengine/tdengine:latest
    container_name: tdengine
    ports:
        - "6030:6030"
        - "6041:6041"
    volumes:
        - "./data/tdengine/data:/var/lib/taos"

Referring to the official example, it is almost the same as the syntax of mysql, which is standard SQL syntax:

taos> CREATE DATABASE demo;
Create OK, 0 row(s) affected (0.221636s)

taos> USE demo;
Database changed.

taos> CREATE TABLE t (ts TIMESTAMP, speed INT);
Create OK, 0 row(s) affected (0.001332s)

taos> INSERT INTO t VALUES('2019-07-15 00:00:00', 10);
Insert OK, 1 row(s) affected (0.000975s)

taos> INSERT INTO t VALUES('2019-07-15 01:00:00', 20);
Insert OK, 1 row(s) affected (0.000979s)

taos> SELECT * FROM t;
           ts            |    speed    |
========================================
 2019-07-15 00:00:00.000 |          10 |
 2019-07-15 01:00:00.000 |          20 |
Query OK, 2 row(s) in set (0.001955s)

At the same time, there are python libraries that can be used directly:

https://docs.taosdata.com/connector/python/

3. Docker Compose builds TDengine cluster

https://blog.csdn.net/firewater23/article/details/125793627

Guess you like

Origin blog.csdn.net/freewebsys/article/details/135374833