Get Started with TDengine TSDB Using an Installation Package
You can install TDengine TSDB on Linux and Windows. To install TDengine TSDB in a Docker container instead of on your machine, see Get Started with TDengine TSDB in Docker.
Before You Begin
- Verify that your machine meets the minimum system requirements for TDengine TSDB. For more information, see Supported Platforms and System Requirements.
- (Windows only) The installer checks for Microsoft Visual C++ Redistributable 2015-2022 x64 version 14.44 or later. If it is missing or outdated, the installer can install the bundled 14.50.35719.0 redistributable after you confirm the prompt. If the installation fails, download the latest supported package from Microsoft Visual C++ Redistributable latest supported downloads.
Procedure
- Linux
- Windows
-
Download the tar.gz installation package from the list below:
-
Navigate to the directory where the package is located and extract it using
tar. For example, on an x64 architecture:tar -zxvf tdengine-tsdb-enterprise-{{VERSION}}-linux-x64.tar.gz -
After extracting the files, go into the subdirectory and run the
install.shscript:sudo ./install.sh
- Download the Windows installation package from the list below:
- Run the installation package and follow the on-screen instructions to complete the installation of TDengine TSDB.
For more package types and versions, visit the TDengine Download Center.
Start the Service
- Linux
- Windows
After installation, execute the following script in your terminal to start all services:
sudo start-all.sh
All TDengine TSDB components are managed by systemd. You can check their service status with the following commands:
sudo systemctl status taosd
sudo systemctl status taosadapter
sudo systemctl status taoskeeper
sudo systemctl status taos-explorer
If the output shows the status as Active: active (running) since ..., it means the services have started successfully.
After installation, open a Command Prompt window as administrator. start-all.bat is the unified entry script. With no arguments it starts services by default; it also supports the status and stop subcommands.
Start all services:
C:\TDengine\start-all.bat
Check service status:
C:\TDengine\start-all.bat status
Stop all services:
C:\TDengine\start-all.bat stop
To inspect the raw status of each Windows service, run:
sc query taosd
sc query taosadapter
sc query taosx
sc query taoskeeper
sc query taos-explorer
If start-all.bat status shows running, or sc query output contains RUNNING, the corresponding service has started successfully.
Quick Start
Open the Command Line
TDengine provides the taos command-line tool for checking service status, running SQL, and managing databases and tables. After you enter the shell, you can try write and query operations immediately.
On Linux or macOS, run:
taos
On Windows, run:
taos.exe
After you enter the shell, the prompt looks like:
taos>
In the shell, each SQL statement must end with a semicolon (;). The following example creates a database, inserts two rows, and queries the result:
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)
Besides SQL, you can use the shell to check system status and manage users. The CLI and client drivers can also be installed separately on other machines. For details, see TDengine CLI.
Write Test Data
taosBenchmark is a TDengine testing tool for generating sample data and trying write, query, and subscription features. It can simulate data from many devices and supports configuring the database, supertable, tag columns, data columns, subtable count, records per subtable, write interval, worker threads, and whether to write out-of-order data.
After confirming that the TDengine service is running, run the following command in a terminal:
taosBenchmark -y
This automatically creates a supertable named meters in the test database. The supertable contains 10,000 subtables named d0 through d9999, each with 10,000 records. Each record has four fields: ts (timestamp), current, voltage, and phase. Timestamps range from 2017-07-14 10:40:00.000 to 2017-07-14 10:40:09.999. Each table also has two tags, location and groupId, where groupId is from 1 to 10 and location includes California cities such as California.Campbell and California.Cupertino.
The command writes 100 million records. Elapsed time depends on hardware; even on a typical PC server, it usually takes only about ten seconds.
taosBenchmark provides many options for customizing table count, record count, and other test settings. Run the following command to list all parameters:
taosBenchmark --help
For detailed usage, see taosBenchmark Reference.
Query Test Data
After writing data with taosBenchmark, run the following queries in the shell to experience query performance.
- Count all records under the
meterssupertable:
SELECT COUNT(*) FROM test.meters;
count(*) |
===================
100000000 |
Query OK, 1 row(s) in set (0.075247s)
- Compute the average, maximum, and minimum over 100 million records:
SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
avg(current) | max(voltage) | min(phase) |
===============================================
10.2084751316071 | 258 | 145 |
Query OK, 1 row(s) in set (0.094037s)
- Count records where
location = "California.SanFrancisco":
SELECT COUNT(*) FROM test.meters WHERE location = "California.SanFrancisco";
count(*) |
===================
10340000 |
Query OK, 1 row(s) in set (0.050540s)
- Compute the average, maximum, and minimum for all records where
groupId = 10:
SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
avg(current) | max(voltage) | min(phase) |
===============================================
10.2084751316071 | 258 | 145 |
Query OK, 1 row(s) in set (0.033754s)
- Aggregate table
d1001every 10 seconds for average, maximum, and minimum:
SELECT _wstart, AVG(current), MAX(voltage), MIN(phase)
FROM test.d1001 INTERVAL(10s);
_wstart | avg(current) | max(voltage) | min(phase) |
=========================================================================
2017-07-14 10:40:00.000 | 10.2084751316071 | 258 | 145 |
Query OK, 1 row(s) in set (0.004716s)
In the query above, the system pseudocolumn _wstart is the start time of each window.
Go Further
After finishing the steps above, continue with:
- Basic Concepts
- Data Modeling
- Data Ingestion
- Data Querying
- Data Subscription
- Stream Processing
- Visual Management
- Grafana Integration
- Zero-Code Data Ingestion
What to Do Next
After this quick start, continue with later chapters to learn more about TDengine data modeling, writing, querying, data subscription, and stream processing.