03-package.md 9.4 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

D
danielclow 已提交
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, 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

D
danielclow 已提交
14
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download a lite package that includes only `taosd` and the C/C++ connector.
15

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

## Installation
19 20

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

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

```bash
D
danielclow 已提交
28 29
# Enter the name of the package that you downloaded.
sudo dpkg -i TDengine-server-<version>-Linux-x64.deb
30 31
```

D
danielclow 已提交
32
</TabItem>
33

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

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

```bash
D
danielclow 已提交
41 42
# Enter the name of the package that you downloaded.
sudo rpm -ivh TDengine-server-<version>-Linux-x64.rpm
43 44 45 46
```

</TabItem>

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

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

```bash
D
danielclow 已提交
54 55
# Enter the name of the package that you downloaded.
tar -zxvf TDengine-server-<version>-Linux-x64.tar.gz
56 57
```

D
danielclow 已提交
58
In the directory to which the package was decompressed, run `install.sh`:
59 60

```bash
D
danielclow 已提交
61
sudo ./install.sh
62 63
```

D
danielclow 已提交
64 65 66 67
:::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.
:::

68 69
</TabItem>

D
danielclow 已提交
70 71 72 73 74
<TabItem label="Windows" value="windows">           

1. Download the Windows installation package.
<PkgListV3 type={3}/>
2. Run the downloaded package to install TDengine.
wafwerar's avatar
wafwerar 已提交
75 76 77
:::info
The server only supports Windows Server 2016/2019 and windows 10/11 system versions on the windows platform.
:::
wafwerar's avatar
wafwerar 已提交
78

D
danielclow 已提交
79 80 81
</TabItem>
<TabItem value="apt-get" label="apt-get">
You can use `apt-get` to install TDengine from the official package repository.
82

D
danielclow 已提交
83
**Configure the package 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-stable stable main" | sudo tee /etc/apt/sources.list.d/tdengine-stable.list
88 89
```

D
danielclow 已提交
90
You can install beta versions by configuring the following repository:
91 92

```bash
D
danielclow 已提交
93 94
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
95 96
```

D
danielclow 已提交
97
**Install TDengine with `apt-get`**
98

D
danielclow 已提交
99 100 101 102 103
```bash
sudo apt-get update
apt-cache policy tdengine
sudo apt-get install tdengine
```
104

D
danielclow 已提交
105 106 107
:::tip
This installation method is supported only for Debian and Ubuntu.
::::
108 109 110
</TabItem>
</Tabs>

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

115
:::note
D
danielclow 已提交
116
On the first node in your TDengine cluster, leave the `Enter FQDN:` prompt blank and press **Enter**. On subsequent nodes, you can enter the end point of the first dnode in the cluster. You can also configure this setting after you have finished installing TDengine.
117 118 119

:::

D
danielclow 已提交
120
## Quick Launch
121

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

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

```bash
systemctl start taosd
```

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

```bash
systemctl status taosd
```

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

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

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

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

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

D
danielclow 已提交
151
The following `systemctl` commands can help you manage TDengine:
152

D
danielclow 已提交
153
- Start TDengine Server: `systemctl start taosd`
154

D
danielclow 已提交
155
- Stop TDengine Server: `systemctl stop taosd`
156

D
danielclow 已提交
157
- Restart TDengine Server: `systemctl restart taosd`
158

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

:::info

D
danielclow 已提交
163 164 165
- 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.
166 167 168

:::

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

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

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

</TabItem>
</Tabs>

## Command Line Interface
179

D
danielclow 已提交
180
You can use the TDengine CLI to monitor your TDengine deployment and execute ad hoc queries. To open the CLI, run the following command:
181 182 183 184 185

```bash
taos
```

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

```cmd
taos>
```

D
danielclow 已提交
192
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:
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207

```sql
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)
```

D
danielclow 已提交
208
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/).
209

D
danielclow 已提交
210
## Test data insert performance
211

D
danielclow 已提交
212
After your TDengine Server is running normally, you can run the taosBenchmark utility to test its performance:
213 214 215 216 217

```bash
taosBenchmark
```

D
danielclow 已提交
218
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 ten and a `location` tag of either `California.SanFrancisco` or `California.LosAngeles`.
219

D
danielclow 已提交
220
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 less than a minute.
221

D
danielclow 已提交
222
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).
223

D
danielclow 已提交
224
## Test data query performance
225

D
danielclow 已提交
226
After using taosBenchmark to create your test deployment, you can run queries in the TDengine CLI to test its performance:
227

D
danielclow 已提交
228
Query the number of rows in the `meters` supertable:
229 230 231 232 233

```sql
taos> select count(*) from test.meters;
```

D
danielclow 已提交
234
Query the average, maximum, and minimum values of all 100 million rows of data:
235 236 237 238 239

```sql
taos> select avg(current), max(voltage), min(phase) from test.meters;
```

D
danielclow 已提交
240
Query the number of rows whose `location` tag is `California.SanFrancisco`:
241 242 243 244 245

```sql
taos> select count(*) from test.meters where location="California.SanFrancisco";
```

D
danielclow 已提交
246
Query the average, maximum, and minimum values of all rows whose `groupId` tag is `10`:
247 248 249 250 251

```sql
taos> select avg(current), max(voltage), min(phase) from test.meters where groupId=10;
```

D
danielclow 已提交
252
Query the average, maximum, and minimum values for table `d10` in 10 second intervals:
253 254 255 256

```sql
taos> select avg(current), max(voltage), min(phase) from test.d10 interval(10s);
```