03-package.md 10.3 KB
Newer Older
1
---
D
danielclow 已提交
2 3
sidebar_label: Package
title: Quick Install from Package
4 5 6 7
---

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

D
danielclow 已提交
10
For information about installing 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).
11

12
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).
13

14
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.
15

16
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.
D
danielclow 已提交
17 18

## Installation
19 20

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

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

27 28
> Please replace `<version>` with the corresponding version of the package downloaded

29
```bash
D
danielclow 已提交
30
sudo dpkg -i TDengine-server-<version>-Linux-x64.deb
31 32
```

D
danielclow 已提交
33
</TabItem>
34

D
danielclow 已提交
35
<TabItem label=".rpm" value="rpminst">
36

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

41 42
> Please replace `<version>` with the corresponding version of the package downloaded

43
```bash
D
danielclow 已提交
44
sudo rpm -ivh TDengine-server-<version>-Linux-x64.rpm
45 46 47 48
```

</TabItem>

D
danielclow 已提交
49 50 51
<TabItem label=".tar.gz" value="tarinst">

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

55 56
> Please replace `<version>` with the corresponding version of the package downloaded

57
```bash
D
danielclow 已提交
58
tar -zxvf TDengine-server-<version>-Linux-x64.tar.gz
59 60
```

D
danielclow 已提交
61
In the directory to which the package was decompressed, run `install.sh`:
62 63

```bash
D
danielclow 已提交
64
sudo ./install.sh
65 66
```

D
danielclow 已提交
67 68 69 70
:::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.
:::

71 72
</TabItem>

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

D
danielclow 已提交
76
**Configure the package repository**
77 78

```bash
D
danielclow 已提交
79 80
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
81 82
```

D
danielclow 已提交
83
You can install beta versions by configuring the following repository:
84 85

```bash
D
danielclow 已提交
86 87
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
88 89
```

D
danielclow 已提交
90
**Install TDengine with `apt-get`**
91

D
danielclow 已提交
92 93 94 95 96
```bash
sudo apt-get update
apt-cache policy tdengine
sudo apt-get install tdengine
```
97

D
danielclow 已提交
98 99 100
:::tip
This installation method is supported only for Debian and Ubuntu.
::::
wafwerar's avatar
wafwerar 已提交
101
</TabItem>
102
<TabItem label="Windows" value="windows">
wafwerar's avatar
wafwerar 已提交
103

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

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

110 111 112
</TabItem>
</Tabs>

D
danielclow 已提交
113
:::info
114
For information about TDengine releases, see [Release History](../../releases).
D
danielclow 已提交
115 116
:::

117
:::note
118
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.
119 120 121

:::

D
danielclow 已提交
122
## Quick Launch
123

D
danielclow 已提交
124 125 126 127
<Tabs>
<TabItem label="Linux" value="linux">

After the installation is complete, run the following command to start the TDengine service:
128 129 130 131 132

```bash
systemctl start taosd
```

D
danielclow 已提交
133
Run the following command to confirm that TDengine is running normally:
134 135 136 137 138

```bash
systemctl status taosd
```

D
danielclow 已提交
139
Output similar to the following indicates that TDengine is running normally:
140 141 142 143 144

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

D
danielclow 已提交
145
Output similar to the following indicates that TDengine has not started successfully:
146 147 148 149 150

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

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

153
The following `systemctl` commands can help you manage TDengine service:
154

D
danielclow 已提交
155
- Start TDengine Server: `systemctl start taosd`
156

D
danielclow 已提交
157
- Stop TDengine Server: `systemctl stop taosd`
158

D
danielclow 已提交
159
- Restart TDengine Server: `systemctl restart taosd`
160

D
danielclow 已提交
161
- Check TDengine Server status: `systemctl status taosd`
162 163 164

:::info

165
- The `systemctl` command requires _root_ privileges. If you are not logged in as the _root_ user, use the `sudo` command.
D
danielclow 已提交
166 167
- 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.
168 169 170

:::

D
danielclow 已提交
171 172 173 174 175 176 177 178 179
</TabItem>

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

After the installation is complete, run `C:\TDengine\taosd.exe` to start TDengine Server.

</TabItem>
</Tabs>

180
## Command Line Interface (CLI)
181

182
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.
183 184 185 186 187

```bash
taos
```

D
danielclow 已提交
188
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.
189 190 191 192 193

```cmd
taos>
```

D
danielclow 已提交
194
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:
195 196

```sql
197 198 199 200 201 202 203
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;

204 205 206 207
           ts            |    speed    |
========================================
 2019-07-15 00:00:00.000 |          10 |
 2019-07-15 01:00:00.000 |          20 |
208

209 210 211
Query OK, 2 row(s) in set (0.003128s)
```

D
danielclow 已提交
212
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](../../reference/taos-shell/).
213 214 215 216 217 218 219 220 221 222 223

## 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.

```bash
taosBenchmark
```

224
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`.
225 226 227 228 229

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 已提交
230
## Test data query performance
231

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

234
From the TDengine CLI (taos) query the number of rows in the `meters` supertable:
235 236

```sql
237
SELECT COUNT(*) FROM test.meters;
238 239
```

D
danielclow 已提交
240
Query the average, maximum, and minimum values of all 100 million rows of data:
241 242

```sql
243
SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
244 245
```

246
Query the number of rows whose `location` tag is `California.SanFrancisco`:
247 248

```sql
249
SELECT COUNT(*) FROM test.meters WHERE location = "California.SanFrancisco";
250 251
```

D
danielclow 已提交
252
Query the average, maximum, and minimum values of all rows whose `groupId` tag is `10`:
253 254

```sql
255
SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
256 257
```

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

```sql
261
SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);
262
```
263 264

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/).