Table of contents
First look at the official website for installation
Select the format for writing data
First look at the official website for installation
Quickly experience TDengine through Docker | TDengine Documentation | Taosi Data
docker pull docker pull tdengine/tdengine:latest after downloading the image
When installing by yourself, you must create a mounting directory. So create the directory first
1. Create a mounting directory and give the file read and write permissions.
sudo mkdir -p /data1/TDengine/taos/log
sudo mkdir -p /data1/TDengine/taos/data
Merge creation statement form: mkdir -p /data1/TDengine/taos/{data,log}
3. Start the container
sudo docker run -d --name tdengine -p 6041:6041 -p 6030-6035:6030-6035 -p 6030-6035:6030-6035/udp -v /data1/TDengine/taos/log:/var/log/; taos -v /data1/TDengine/taos/data:/var/lib/taos tdengine/tdengine:latest
explain
#--name tdengine ##Specify the container name for easy access
#-p 6041:6041 ##Map RESTful port
#-p 6030-6035:6030-6035
#-p 6030-6035:6030-6035/udp ##Map taos client The port used by the end must include TCP and UDP
#-v /wahle/v-TDengine/taos/log:/var/log/taos ##Mapping log directory
#-v /wahle/v-TDengine/taos/data:/var /lib/taos ##Mapping data directory
#tdengine/tdengine:latest ## The latest image version name is tdengine
4. Enter the TD database and change the TD root password. The default password is: taosdata
[root@dev TDengine-server]# taos
taos> alter user root pass '123456';
5. Official website’s visual management tool TDengineGUI
download address: Third-party tools | TDengine documentation | Taosi Data
6. Conceptual differences between vnode mnode dnode
Document - Taosi Data | TDengine
Instructions
database
Collection quantity metric The collection physical quantity of the device
Label label/tag static attribute of the device. But TDengine allows users to modify, delete or add tag values.
data collection point data collection point
Dengine adopts the strategy of one data collection point and one table , requiring a separate table to be created for each data collection point.
A table is used to represent a specific data collection point, and a super table is used to represent a set of data collection points of the same type.
Back up data
Create backup directory
mkdir /taos/dump
Backup database test
taosdump -o /taos/dump/ -D test
cat dump_result.txt
Delete database
drop database test;
show databases;
Data recovery
taosdump -i /taos/dump
Check data
select count(*) from meters;
Application scenarios
The client creates a new database and reports an error.
Select the format for writing data
SQL writing in TDengine is schema writing. Before writing to the Database, the Schema of the data table needs to be predefined, specifically how many columns the data table contains and what type of data is stored in each column. That is, when creating a table, use standard SQL statements to specify the Schema of the table, and then write data according to the number and type of pre-built columns and tag values.
In addition to SQL writing, TDengine also supports three modeless writing protocols, namely InfluxDB Line protocol, OpenTSDB Telnet protocol and OpenTSDB JSON format protocol. If you are familiar with NoSQL, then schemaless writing should be familiar to you. Generally speaking, modeless writing provides users with a more convenient way to write data to TDengine in text format.
Applications in IoT scenarios often need to collect a large number of data items to implement intelligent control, business analysis, equipment monitoring, etc. Due to version upgrades of application logic or hardware adjustments of the equipment itself, data collection items may be relatively large. Frequent changes occur. In order to still complete the data recording work conveniently in this situation, TDengine has provided a modeless writing method since version 2.2. There is no need to create super tables and subtables in advance when writing, and its engine can adapt data and adjust the table structure.
Problem record
1. Pay attention to permission issues
2. If after starting once, it fails to start again. Remember to clear the data directory and og directory.
Access the database after installation
Enter the container
docker exec -it tdengine sh
>taos
Supports multiple data writing methods: sql, influxdb, openstdb telnet, opentadb json
Specific operating document guidance:
InfluxDB row protocol | TDengine documentation | Taosi data
3. Error when creating database DB error: Out of dnodes (0.000000s)
Solution instructions:
This error message indicates that TDengine has run out of data nodes and cannot continue to create a new database. This may be because there are already a large number of databases or data tables in your TDengine database, and the system does not have enough resources to support the creation of new databases.
To resolve this issue, you can try the following:
View existing databases and data tables, and delete data that is no longer needed: Use the SHOW DATABASES and SHOW TABLES
commands to view existing databases and data tables, and use the DROP DATABASE and DROP TABLE commands to delete databases and data that are no longer needed. surface. Adjust the configuration parameters of TDengine to increase the number of data nodes: You can increase the number of data nodes
by modifying the parameters (such as vnode.count and vnode.cache.size) in the configuration file (taos.cfg) .
For specific parameter settings, please refer to the official documentation of TDengine.
Expand the server resources of TDengine: If the above two methods cannot solve the problem, you can consider expanding the server resources of TDengine, such as increasing
CPU, memory and hard disk capacity, to support more data nodes.
Find the configuration file directory: /usr/local/taos/cfg/taos.cfg
Modify parameters supportVnodes
After modification, restart the docker service to take effect.