03-package.md 12.6 KB
Newer Older
1
---
D
danielclow 已提交
2
title: Quick Install from Package
D
danielclow 已提交
3 4
sidebar_label: Package
description: This document describes how to install TDengine on Linux, Windows, and macOS and perform queries and inserts.
5 6 7 8
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
D
danielclow 已提交
9
import PkgListV3 from "/components/PkgListV3";
10

wafwerar's avatar
wafwerar 已提交
11
This document describes how to install TDengine on Linux/Windows/macOS and perform queries and inserts.
12

D
danielclow 已提交
13
- The easiest way to explore TDengine is through [TDengine Cloud](https://cloud.tdengine.com). 
14 15
- To get started with TDengine on Docker, see [Quick Install on Docker](../../get-started/docker).
- If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine).
16

17
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](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter).
18

19
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.
20

wafwerar's avatar
wafwerar 已提交
21
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 x64 Windows and x64/m1 macOS.
D
danielclow 已提交
22

D
dapan1121 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35
## Operating environment requirements
In the Linux system, the minimum requirements for the operating environment are as follows:

linux core version - 3.10.0-1160.83.1.el7.x86_64;

glibc version - 2.17;

If compiling and installing through clone source code, it is also necessary to meet the following requirements:

cmake version - 3.26.4 or above;

gcc version - 9.3.1 or above;

D
danielclow 已提交
36
## Installation
37 38

<Tabs>
D
danielclow 已提交
39
<TabItem label=".deb" value="debinst">
40

41 42
1. Download the Deb installation package.
   <PkgListV3 type={6}/>
D
danielclow 已提交
43
2. In the directory where the package is located, use `dpkg` to install the package:
44

45 46
> Please replace `<version>` with the corresponding version of the package downloaded

47
```bash
D
danielclow 已提交
48
sudo dpkg -i TDengine-server-<version>-Linux-x64.deb
49 50
```

D
danielclow 已提交
51
</TabItem>
52

D
danielclow 已提交
53
<TabItem label=".rpm" value="rpminst">
54

D
danielclow 已提交
55
1. Download the .rpm installation package.
56
   <PkgListV3 type={5}/>
D
danielclow 已提交
57
2. In the directory where the package is located, use rpm to install the package:
58

59 60
> Please replace `<version>` with the corresponding version of the package downloaded

61
```bash
D
danielclow 已提交
62
sudo rpm -ivh TDengine-server-<version>-Linux-x64.rpm
63 64 65 66
```

</TabItem>

D
danielclow 已提交
67 68 69
<TabItem label=".tar.gz" value="tarinst">

1. Download the .tar.gz installation package.
70
   <PkgListV3 type={0}/>
D
danielclow 已提交
71
2. In the directory where the package is located, use `tar` to decompress the package:
72

73 74
> Please replace `<version>` with the corresponding version of the package downloaded

75
```bash
D
danielclow 已提交
76
tar -zxvf TDengine-server-<version>-Linux-x64.tar.gz
77 78
```

D
danielclow 已提交
79
In the directory to which the package was decompressed, run `install.sh`:
80 81

```bash
D
danielclow 已提交
82
sudo ./install.sh
83 84
```

D
danielclow 已提交
85 86 87 88
:::info
Users will be prompted to enter some configuration information when install.sh is executing. The interactive mode can be disabled by executing `./install.sh -e no`. `./install.sh -h` can show all parameters with detailed explanation.
:::

89 90
</TabItem>

D
danielclow 已提交
91 92
<TabItem value="apt-get" label="apt-get">
You can use `apt-get` to install TDengine from the official package repository.
93

D
danielclow 已提交
94
**Configure the package repository**
95 96

```bash
D
danielclow 已提交
97 98
wget -qO - http://repos.taosdata.com/tdengine.key | sudo apt-key add -
echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-stable stable main" | sudo tee /etc/apt/sources.list.d/tdengine-stable.list
99 100
```

D
danielclow 已提交
101
You can install beta versions by configuring the following repository:
102 103

```bash
D
danielclow 已提交
104 105
wget -qO - http://repos.taosdata.com/tdengine.key | sudo apt-key add -
echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-beta beta main" | sudo tee /etc/apt/sources.list.d/tdengine-beta.list
106 107
```

D
danielclow 已提交
108
**Install TDengine with `apt-get`**
109

D
danielclow 已提交
110 111 112 113 114
```bash
sudo apt-get update
apt-cache policy tdengine
sudo apt-get install tdengine
```
115

D
danielclow 已提交
116 117
:::tip
This installation method is supported only for Debian and Ubuntu.
D
danielclow 已提交
118
:::
wafwerar's avatar
wafwerar 已提交
119
</TabItem>
120
<TabItem label="Windows" value="windows">
wafwerar's avatar
wafwerar 已提交
121

122
Note: TDengine only supports Windows Server 2016/2019 and Windows 10/11 on the Windows platform.
wafwerar's avatar
wafwerar 已提交
123 124

1. Download the Windows installation package.
125
   <PkgListV3 type={3}/>
wafwerar's avatar
wafwerar 已提交
126 127
2. Run the downloaded package to install TDengine.

wafwerar's avatar
wafwerar 已提交
128
</TabItem>
wafwerar's avatar
wafwerar 已提交
129
<TabItem label="macOS" value="macos">
wafwerar's avatar
wafwerar 已提交
130

wafwerar's avatar
wafwerar 已提交
131
1. Download the macOS installation package.
wafwerar's avatar
wafwerar 已提交
132
   <PkgListV3 type={7}/>
wafwerar's avatar
wafwerar 已提交
133
2. Run the downloaded package to install TDengine. If the installation is blocked, you can right-click or ctrl-click on the installation package and select `Open`.
wafwerar's avatar
wafwerar 已提交
134

135 136 137
</TabItem>
</Tabs>

D
danielclow 已提交
138
:::info
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
139
For information about TDengine other releases, check [Release History](../../releases/tdengine).
D
danielclow 已提交
140 141
:::

142
:::note
143
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.
144 145 146

:::

D
danielclow 已提交
147
## Quick Launch
148

D
danielclow 已提交
149 150 151 152
<Tabs>
<TabItem label="Linux" value="linux">

After the installation is complete, run the following command to start the TDengine service:
153 154 155 156 157

```bash
systemctl start taosd
```

D
danielclow 已提交
158
Run the following command to confirm that TDengine is running normally:
159 160 161 162 163

```bash
systemctl status taosd
```

D
danielclow 已提交
164
Output similar to the following indicates that TDengine is running normally:
165 166 167 168 169

```
Active: active (running)
```

D
danielclow 已提交
170
Output similar to the following indicates that TDengine has not started successfully:
171 172 173 174 175

```
Active: inactive (dead)
```

D
danielclow 已提交
176
After confirming that TDengine is running, run the `taos` command to access the TDengine CLI.
177

178
The following `systemctl` commands can help you manage TDengine service:
179

D
danielclow 已提交
180
- Start TDengine Server: `systemctl start taosd`
181

D
danielclow 已提交
182
- Stop TDengine Server: `systemctl stop taosd`
183

D
danielclow 已提交
184
- Restart TDengine Server: `systemctl restart taosd`
185

D
danielclow 已提交
186
- Check TDengine Server status: `systemctl status taosd`
187 188 189

:::info

190
- The `systemctl` command requires _root_ privileges. If you are not logged in as the _root_ user, use the `sudo` command.
D
danielclow 已提交
191 192
- 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.
193 194 195

:::

wafwerar's avatar
wafwerar 已提交
196 197 198 199
## 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 terminal.

D
danielclow 已提交
200 201 202 203
</TabItem>

<TabItem label="Windows" value="windows">

204
After the installation is complete, please run `sc start taosd` or run `C:\TDengine\taosd.exe` with administrator privilege to start TDengine Server.
D
danielclow 已提交
205

wafwerar's avatar
wafwerar 已提交
206 207 208 209
## 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 run `taos.exe` in the `C:\TDengine` directory of the Windows terminal to start the TDengine command line.

wafwerar's avatar
wafwerar 已提交
210 211
</TabItem>

wafwerar's avatar
wafwerar 已提交
212
<TabItem label="macOS" value="macos">
wafwerar's avatar
wafwerar 已提交
213

wafwerar's avatar
wafwerar 已提交
214
After the installation is complete, double-click the /applications/TDengine to start the program, or run `launchctl start com.tdengine.taosd` to start TDengine Server.
wafwerar's avatar
wafwerar 已提交
215

wafwerar's avatar
wafwerar 已提交
216 217
The following `launchctl` commands can help you manage TDengine service:

218
- Start TDengine Server: `sudo launchctl start com.tdengine.taosd`
wafwerar's avatar
wafwerar 已提交
219

220
- Stop TDengine Server: `sudo launchctl stop com.tdengine.taosd`
wafwerar's avatar
wafwerar 已提交
221

222
- Check TDengine Server status: `sudo launchctl list | grep taosd`
wafwerar's avatar
wafwerar 已提交
223

224 225
- Check TDengine Server status details: `launchctl print system/com.tdengine.taosd`

wafwerar's avatar
wafwerar 已提交
226
:::info
227 228 229 230 231
- Please use `sudo` to run `launchctl` to manage _com.tdengine.taosd_ with administrator privileges.
- The administrator privilege is required for service management to enhance security.
- Troubleshooting:
- The first column returned by the command `launchctl list | grep taosd` is the PID of the program. If it's `-`, that means the TDengine service is not running.
- If the service is abnormal, please check the `launchd.log` file from the system log or the `taosdlog` from the `/var/log/taos directory` for more information.
wafwerar's avatar
wafwerar 已提交
232 233 234

:::

235
## Command Line Interface (CLI)
236

wafwerar's avatar
wafwerar 已提交
237 238 239 240
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 terminal.

</TabItem>
</Tabs>
241 242 243 244 245

```bash
taos
```

D
danielclow 已提交
246
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](/train-faq/faq) for troubleshooting information. At the following prompt, you can execute SQL commands.
247 248 249 250 251

```cmd
taos>
```

D
danielclow 已提交
252
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:
253 254

```sql
255 256 257 258 259 260 261
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;

262 263 264 265
           ts            |    speed    |
========================================
 2019-07-15 00:00:00.000 |          10 |
 2019-07-15 01:00:00.000 |          20 |
266

267 268 269
Query OK, 2 row(s) in set (0.003128s)
```

wafwerar's avatar
wafwerar 已提交
270
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 machines. For more information, see [TDengine CLI](../../reference/taos-shell/).
271 272 273 274 275

## Test data insert performance

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

wafwerar's avatar
wafwerar 已提交
276
Start TDengine service and execute `taosBenchmark` (formerly named `taosdemo`) in a terminal.
277 278 279 280 281

```bash
taosBenchmark
```

282
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`.
283 284 285 286 287

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](../../reference/taosbenchmark).

D
danielclow 已提交
288
## Test data query performance
289

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

292
From the TDengine CLI (taos) query the number of rows in the `meters` supertable:
293 294

```sql
295
SELECT COUNT(*) FROM test.meters;
296 297
```

D
danielclow 已提交
298
Query the average, maximum, and minimum values of all 100 million rows of data:
299 300

```sql
301
SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
302 303
```

304
Query the number of rows whose `location` tag is `California.SanFrancisco`:
305 306

```sql
307
SELECT COUNT(*) FROM test.meters WHERE location = "California.SanFrancisco";
308 309
```

D
danielclow 已提交
310
Query the average, maximum, and minimum values of all rows whose `groupId` tag is `10`:
311 312

```sql
313
SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
314 315
```

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

```sql
319
SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);
320
```
321 322

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](../../taos-sql/distinguished/).