TDengine installation and performance test

TDengine official documentation

1. Select the installation file versioninsert image description here

TDengine is divided into server and client. Usually, the server can be installed. If the server and client are not on the same host, the client needs to be installed separately.

2. Upload the downloaded tar package to the server

After uploading to the server, unzip it.

#Replace with the downloaded installation package version
tar -zxvf TDengine-server--Linux-x64.tar.gz

insert image description here
There are two folders, a compressed file and install.sh installation execution file, enter the corresponding installation directory, that is, the directory where the ./install.sh file is located, and execute the command:

#Administrator privileges are required, if you are not an administrator account to log in, add sudo to grant corresponding privileges
sudo ./install.sh

insert image description here
At this point, the installation is complete!

Note:
1. When installing the first node, when the Enter FQDN: prompt appears, there is no need to enter anything. Only when installing the second or later nodes, you need to enter the FQDN of any available node in the existing cluster to support the new node to join the cluster. Of course, you can also not enter it, but configure it in the configuration file of the new node before the new node starts.
2. TDengine uses FQDN to access instead of IP address, because the IP address may change in the production environment, so configure the hostname to modify the
insert image description here
hosts file, command: vim /etc/hosts
The author's configuration is: insert image description here
among them: 192.168. 1.106 is the server (virtual machine IP address, you can use the command ifconfig -a to view), localdomain.com is the linux host name (this is not written casually, you can use the command hostname -f to view)

3. Start

#After installation, please use the systemctl command to start the service process of TDengine.
systemctl start taosd

#Check whether the service is working normally:
systemctl status taosd
insert image description here

If the TDengine service works normally, you can access and experience TDengine through TDengine's command line program taos.

Summary of systemctl commands:
Start the service process: systemctl start taosd
Stop the service process: systemctl stop taosd
Restart the service process: systemctl restart taosd
Check the service status: systemctl status taosd

Note:
The systemctl stop taosd command will not stop the TDengine service immediately after execution, but will wait for the normal completion of the necessary disk loading in the system. In the case of a large amount of data, this may take a long time;
if the system does not support systemd, you can also manually start the TDengine service by running /usr/local/taos/bin/taosd.

4. Quick experience of TDengine command line

Terminal input command:

taos
insert image description here
So far, the service connection is successful!

We can use SQL commands to create/delete databases, tables, etc., and perform database (database) insertion query operations,
for example:
1: Create a database:
insert image description here
2: Create a table
insert image description here
3, insert records
insert image description here
4, query records
insert image description here

5. Reading and writing test

5.1 Write performance

InfluxDB is currently the most popular TSDB in the industry. It is famous for its performance as an outstanding feature and as an industry benchmark. TDengine officially praised that under the optimal environmental conditions of InfluxDB, the writing speed of TDengine is twice that of it! And when the number of devices is enlarged to 1000, the writing speed of TDengine is 5.2 times that of InfluxDB!

TDengine has officially built the taosBenchmark command to facilitate users to quickly experience TDengine's library writing performance.
After starting the TDengine service, enter in the terminal:

taosBenchmark

This command will automatically create a super table meters under the database test, there are 10,000 tables under the super table, the table names are "d0" to "d9999", each table has 10,000 records, and each record has ( ts, current, voltage, phase) four fields, timestamps from "2017-07-14 10:40:00 000" to "2017-07-14 10:40:09 999", each table has the label location and groupId, groupId is set to 1 to 10, location is set to "California.SanFrancisco" or "California.LosAngeles". A total of 100 million records!

The author's current virtual machine configuration: 2-core 3G 20G storage
The actual test is as follows:
insert image description here
**It takes 84.6 seconds to start 8 threads to create a table and insert 100 million records, with an average of 1,180,000 records written per second! **I remember that when I tested the batch insertion of mysql in the batch insertion performance optimization of mybatisPlus before, it took about 4 seconds to write 50,000 pieces of data (of course this is only a rough analogy, after all, the two are applicable to different businesses) . The performance of TDengine is indeed astounding!

5.2 Read performance

Query the total number of records under the super table: (it takes 0.35s, amazing!)
insert image description here

Query the average, maximum, minimum, etc. of 100 million records: (8.4 seconds)
insert image description here

Query the average value, maximum value, minimum value, etc. of all records of groupId=10: (takes 0.86 seconds)
insert image description here

Guess you like

Origin blog.csdn.net/weixin_42194695/article/details/126752604