How to Install and Run TDengine While Your Coffee/Tea is Brewing

Chait Diwadkar
Chait Diwadkar

TDengine is a very popular open source time-series database (TSDB) on Github with 17.7K stars. It is highly optimized and purpose-built from scratch for IoT Big Data and has built-in scalability, with cluster support even in the open-source version. It supports standard SQL and provides extensions specifically for useful time-series analysis queries.

See video

TDengine is very simple to install and use if you are curious about TSDB or are looking for a high-performance, scalable TSDB for an IoT Big Data project or a monitoring project. TDEngine is also the perfect TSDB if you are moving from a generic database like PostgreSQL or MySQL because you can reuse any queries with little to no change. If you are looking to migrate from InfluxData because their open-source version is limited to a single node, TDengine provides the taosAdapter to seamlessly ingest and migrate your InfluxData application to TDEngine.

In this blog we will address the installation using a Debian package. The process is very similar if you will be installing from an RPM package. In future blogs we will address installing TDengine using a Docker container and building TDengine from source.

At this point you can start brewing your coffee or tea.

Installing the TDengine Debian Package

TDengine is provide in .rpm, .deb and .tar.gz formats to cater to your choice of OS, package manager or your enterprise needs. We recommend installing the standard server package which includes client libraries and sample code. We also recommend installing the latest stable release

Download the latest Debian package from the official website. Note that you will see a modal dialog asking for your email address so that you can receive a download link. No registration or any other information is required.

Once you have received the download link and downloaded the Debian package, go to the directory where you have downloaded the package.

In your terminal enter the following:

sudo dpkg -i TDengine-server-

You will then see the following output:

Selecting previously unselected package tdengine.
(Reading database ... 230481 files and directories currently installed.)
Preparing to unpack TDengine-server- ...
Unpacking tdengine ( ...
Setting up tdengine ( ...
Start to install TDengine...
System hostname is: osboxes

Now you will be prompted for some information. You can hit “Enter/Return” for all of them for simplicity.

Enter FQDN:port (like of an existing TDengine cluster node to join OR leave it blank to build one:

Enter your email address for priority support or enter empty to skip:

You will now see the following output.

Created symlink /etc/systemd/system/ → /etc/systemd/system/taosd.service.
To configure TDengine : edit /etc/taos/taos.cfg
To start TDengine : sudo systemctl start taosd
To access TDengine : taos -h osboxes to login into TDengine server
TDengine is installed successfully!

At this point you are done with the installation.

Running TDengine

Now you can start TDengine by running the following command.

systemctl start taosd

You will now see output as follows:

● taosd.service - TDengine server service
Loaded: loaded (/etc/systemd/system/taosd.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-02-20 20:29:33 PST; 9s ago
Process: 5903 ExecStartPre=/usr/local/taos/bin/ (code=exited, status=0/SUCCES>
Main PID: 5909 (taosd)
Tasks: 42 (limit: 9463)
Memory: 21.1M
CGroup: /system.slice/taosd.service
└─5909 /usr/bin/taosd
Feb 20 20:29:33 osboxes systemd[1]: Starting TDengine server service...
Feb 20 20:29:33 osboxes systemd[1]: Started TDengine server service.
Feb 20 20:29:33 osboxes TDengine:[5909]: Starting TDengine service...
Feb 20 20:29:33 osboxes TDengine:[5909]: Started TDengine service successfully.
Now you can run the TDengine shell by typing "taos" at the Linux command line.
(base)osboxes@oxboxes:~$ taos
Welcome to the TDengine shell from Linux, Client Version: Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.

From here you can create tables, insert data and run queries against your data as follows.

Create Database, Insert and Query Data

TDengine has the concept of supertables and one table per source. This is done intentionally to make TDengine extremely fast. This will be explained further in a separate blog but the supertable is kind of a template, an abstract collection for the same types of data sources. The supertable represents a set of tables that have the same schema but different static attributes.

For e.g. bike-sharing data from the City of Toulouse looks as follows:

2016-04-01 00:00:07,1,metro-canal-du-midi,75,light rain,81,1017.0,6.54,9.3
2016-04-01 00:00:16,3,place-des-carmes,75,light rain,81,1017.0,6.54,9.3
2016-04-01 00:00:35,3,place-des-carmes,75,light rain,81,1017.0,6.54,9.3
2016-04-01 00:04:50,2,place-esquirol,75,light rain,81,1017.0,6.54,9.3

As you can see, each station has the same type of data but only the station name is an attribute, a tag. So we’ll create a supertable with a station identifier as the tag and then we’ll create individual tables for each station.

First we’ll create a database.

create database demo;

Now let’s switch to the database we just created.

use demo;

Now we’ll create the supertable and then a table called station01 for the metro-canal-du-midi location.

create stable bikeshare (ts timestamp, numBikes int, clouds int, description binary(64), humidity float, pressure float, temperature float, wind float) tags (station binary(64));

CREATE TABLE station01 USING bikeshare TAGS ("metro-canal-du-midi");

insert into station01 using bikeshare tags ("metro-canal-du-midi") values ("2016-04-01 00:00:07",1,75,"light rain",81,1017.0,6.54,9.3);

Now we can query the data in the table.

taos> select * from station01;
ts | numbikes | clouds | description | humidity | pressure | temperature | wind |
2016-04-01 00:00:07.000 | 1 | 75 | light rain | 81.00000 | 1017.00000 | 6.54000 | 9.30000 |
2016-04-01 00:15:00.000 | 1 | 75 | light rain | 83.00000 | 1017.00000 | 6.74000 | 9.40000 |
Query OK, 2 row(s) in set (0.005978s)

Similarly you can create tables for other stations and insert and query data. In a future blog we will show you how to import large amounts of data into TDengine.

Most likely your coffee or tea has just about finished brewing.


  • Chait Diwadkar
    Chait Diwadkar

    Chait Diwadkar is Director of Solution Engineering at TDengine. Prior to joining TDengine he was in the biotechnology industry in technical marketing, professional services, and product management roles and supported customers in pharma, medical devices and diagnostics on analytical chemistry, and genetic platforms.