Skip to main content

Quick Install from Package

This document describes how to install TDengine on Linux and Windows and perform queries and inserts.

The full package of TDengine includes the TDengine Server (taosd), TDengine Client (taosc), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a REST API through taosAdapter.

The standard server installation package includes taos, taosd, taosAdapter, taosBenchmark, and sample code. You can also download the Lite package that includes only taosd and the C/C++ connector.

The TDengine Community Edition is released as Deb and RPM packages. The Deb package can be installed on Debian, Ubuntu, and derivative systems. The RPM package can be installed on CentOS, RHEL, SUSE, and derivative systems. A .tar.gz package is also provided for enterprise customers, and you can install TDengine over apt-get as well. The .tar.tz package includes taosdump and the TDinsight installation script. If you want to use these utilities with the Deb or RPM package, download and install taosTools separately. TDengine can also be installed on 64-bit Windows.

Installation

  1. Download the Deb installation package.
    • In the directory where the package is located, use dpkg to install the package:

    Please replace <version> with the corresponding version of the package downloaded

    sudo dpkg -i TDengine-server-<version>-Linux-x64.deb
    info

    For information about TDengine releases, see Release History.

    note

    On the first node in your TDengine cluster, leave the Enter FQDN: prompt blank and press Enter. On subsequent nodes, you can enter the endpoint of the first dnode in the cluster. You can also configure this setting after you have finished installing TDengine.

    Quick Launch

    After the installation is complete, run the following command to start the TDengine service:

    systemctl start taosd

    Run the following command to confirm that TDengine is running normally:

    systemctl status taosd

    Output similar to the following indicates that TDengine is running normally:

    Active: active (running)

    Output similar to the following indicates that TDengine has not started successfully:

    Active: inactive (dead)

    After confirming that TDengine is running, run the taos command to access the TDengine CLI.

    The following systemctl commands can help you manage TDengine service:

    • Start TDengine Server: systemctl start taosd

    • Stop TDengine Server: systemctl stop taosd

    • Restart TDengine Server: systemctl restart taosd

    • Check TDengine Server status: systemctl status taosd

    info
    • The systemctl command requires root privileges. If you are not logged in as the root user, use the sudo command.
    • The systemctl stop taosd command does not instantly stop TDengine Server. The server is stopped only after all data in memory is flushed to disk. The time required depends on the cache size.
    • If your system does not include systemd, you can run /usr/local/taos/bin/taosd to start TDengine manually.

    Command Line Interface (CLI)

    You can use the TDengine CLI to monitor your TDengine deployment and execute ad hoc queries. To open the CLI, you can execute taos in the Linux terminal where TDengine is installed, or you can run taos.exe in the C:\TDengine directory of the Windows terminal where TDengine is installed to start the TDengine command line.

    taos

    The TDengine CLI displays a welcome message and version information to indicate that its connection to the TDengine service was successful. If an error message is displayed, see the FAQ for troubleshooting information. At the following prompt, you can execute SQL commands.

    taos>

    For example, you can create and delete databases and tables and run all types of queries. Each SQL command must be end with a semicolon (;). For example:

    CREATE DATABASE demo;
    USE demo;
    CREATE TABLE t (ts TIMESTAMP, speed INT);
    INSERT INTO t VALUES ('2019-07-15 00:00:00', 10);
    INSERT INTO t VALUES ('2019-07-15 01:00:00', 20);
    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.003128s)

    You can also can monitor the deployment status, add and remove user accounts, and manage running instances. You can run the TDengine CLI on either Linux or Windows machines. For more information, see TDengine CLI.

    Test data insert performance

    After your TDengine Server is running normally, you can run the taosBenchmark utility to test its performance:

    Start TDengine service and execute taosBenchmark (formerly named taosdemo) in a Linux or Windows terminal.

    taosBenchmark

    This command creates the meters supertable in the test database. In the meters supertable, it then creates 10,000 subtables named d0 to d9999. Each table has 10,000 rows and each row has four columns: ts, current, voltage, and phase. The timestamps of the data in these columns range from 2017-07-14 10:40:00 000 to 2017-07-14 10:40:09 999. Each table is randomly assigned a groupId tag from 1 to 10 and a location tag of either California.Campbell, California.Cupertino, California.LosAngeles, California.MountainView, California.PaloAlto, California.SanDiego, California.SanFrancisco, California.SanJose, California.SantaClara or California.Sunnyvale.

    The taosBenchmark command creates a deployment with 100 million data points that you can use for testing purposes. The time required to create the deployment depends on your hardware. On most modern servers, the deployment is created in ten to twenty seconds.

    You can customize the test deployment that taosBenchmark creates by specifying command-line parameters. For information about command-line parameters, run the taosBenchmark --help command. For more information about taosBenchmark, see taosBenchmark.

    Test data query performance

    After using taosBenchmark to create your test deployment, you can run queries in the TDengine CLI to test its performance:

    From the TDengine CLI (taos) query the number of rows in the meters supertable:

    SELECT COUNT(*) FROM test.meters;

    Query the average, maximum, and minimum values of all 100 million rows of data:

    SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;

    Query the number of rows whose location tag is California.SanFrancisco:

    SELECT COUNT(*) FROM test.meters WHERE location = "California.SanFrancisco";

    Query the average, maximum, and minimum values of all rows whose groupId tag is 10:

    SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;

    Query the average, maximum, and minimum values for table d10 in 10 second intervals:

    SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);

    In the query above you are selecting the first timestamp (ts) in the interval, another way of selecting this would be \_wstart which will give the start of the time window. For more information about windowed queries, see Time-Series Extensions.