index.md 7.3 KB
Newer Older
D
dingbo 已提交
1
---
D
dingbo 已提交
2
title: Get Started
P
Pan YANG 已提交
3
description: 'Install TDengine from Docker image, apt-get or package, and run TAOS CLI and taosBenchmark to experience the features'
D
dingbo 已提交
4 5 6 7 8 9 10
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import PkgInstall from "./\_pkg_install.mdx";
import AptGetInstall from "./\_apt_get_install.mdx";

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
11
## Quick Install
D
dingbo 已提交
12

13
The full package of TDengine includes the server(taosd), taosAdapter for connecting with third-party systems and providing a RESTful interface, client driver(taosc), command-line program(CLI, taos) and some tools. For the current version, the server taosd and taosAdapter can only be installed and run on Linux systems. In the future taosd and taosAdapter will also be supported on Windows, macOS and other systems. The client driver taosc and TDengine CLI can be installed and run on Windows or Linux. In addition to connectors for multiple languages, TDengine also provides a [RESTful interface](/reference/rest-api) through [taosAdapter](/reference/taosadapter). Prior to version 2.4.0.0, taosAdapter did not exist and the RESTful interface was provided by the built-in HTTP service of taosd.
D
dingbo 已提交
14

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
15
TDengine supports X64/ARM64/MIPS64/Alpha64 hardware platforms, and will support ARM32, RISC-V and other CPU architectures in the future.
D
dingbo 已提交
16 17 18

<Tabs defaultValue="apt-get">
<TabItem value="docker" label="Docker">
P
Pan YANG 已提交
19
If docker is already installed on your computer, execute the following command:
D
dingbo 已提交
20 21 22 23 24

```shell
docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine
```

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
25
Make sure the container is running
D
dingbo 已提交
26 27 28 29 30

```shell
docker ps
```

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
31
Enter into container and execute bash
D
dingbo 已提交
32 33

```shell
P
Pan YANG 已提交
34
docker exec -it <container name> bash
D
dingbo 已提交
35 36
```

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
37
Then you can execute the Linux commands and access TDengine.
D
dingbo 已提交
38

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
39
For detailed steps, please visit [Experience TDengine via Docker](/train-faq/docker)
D
dingbo 已提交
40 41

:::info
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
42
Starting from 2.4.0.10,besides taosd,TDengine docker image includes: taos,taosAdapter,taosdump,taosBenchmark,TDinsight, scripts and sample code. Once the TDengine container is started,it will start both taosAdapter and taosd automatically to support RESTful interface.
D
dingbo 已提交
43 44 45 46 47 48 49

:::

</TabItem>
<TabItem value="apt-get" label="apt-get">
<AptGetInstall />
</TabItem>
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
50
<TabItem value="pkg" label="Package">
D
dingbo 已提交
51 52
<PkgInstall />
</TabItem>
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
53
<TabItem value="src" label="Source Code">
D
dingbo 已提交
54

P
Pan YANG 已提交
55
If you like to check the source code, build the package by yourself or contribute to the project, please check [TDengine GitHub Repository](https://github.com/taosdata/TDengine)
D
dingbo 已提交
56 57 58 59

</TabItem>
</Tabs>

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
60
## Quick Launch
D
dingbo 已提交
61

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
62
After installation, you can launch the TDengine service by the 'systemctl' command to start 'taosd'.
D
dingbo 已提交
63 64 65 66 67

```bash
systemctl start taosd
```

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
68
Check if taosd is running:
D
dingbo 已提交
69 70 71 72 73

```bash
systemctl status taosd
```

74
If everything is fine, you can run TDengine command-line interface `taos` to access TDengine and test it out yourself.
D
dingbo 已提交
75 76 77

:::info

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
78
- systemctl requires _root_ privileges,if you are not _root_ ,please add sudo before the command.
79
- To get feedback and keep improving the product, TDengine is collecting some basic usage information, but you can turn it off by setting telemetryReporting to 0 in configuration file taos.cfg. 
80
- TDengine uses FQDN (usually hostname)as the ID for a node. To make the system work, you need to configure the FQDN for the server running taosd, and configure the DNS service or hosts file on the the machine where the application or TDengine CLI runs to ensure that the FQDN can be resolved.     
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
81
- `systemctl stop taosd` won't stop the server right away, it will wait until all the data in memory are flushed to disk. It may takes time depending on the cache size.
D
dingbo 已提交
82

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
83
TDengine supports the installation on system which runs [`systemd`](https://en.wikipedia.org/wiki/Systemd) for process management,use `which systemctl` to check if the system has `systemd` installed:
D
dingbo 已提交
84 85 86 87 88

```bash
which systemctl
```

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
89
If the system does not have `systemd`,you can start TDengine manually by executing `/usr/local/taos/bin/taosd`
D
dingbo 已提交
90 91 92

:::note

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
93
## Command Line Interface
P
Pan YANG 已提交
94

95
To manage the TDengine running instance,or execute ad-hoc queries, TDengine provides a Command Line Interface (hereinafter referred to as TDengine CLI) taos. To enter into the interactive CLI,execute `taos` on a Linux terminal where TDengine is installed.
D
dingbo 已提交
96 97 98 99 100

```bash
taos
```

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
101
If it connects to the TDengine server successfully, it will print out the version and welcome message. If it fails, it will print out the error message, please check [FAQ](/train-faq/faq) for trouble shooting connection issue. TDengine CLI's prompt is:
D
dingbo 已提交
102 103 104 105 106

```cmd
taos>
```

P
Pan YANG 已提交
107
Inside TDengine CLI,you can execute SQL commands to create/drop database/table, and run queries. The SQL command must be ended with a semicolon. For example:
D
dingbo 已提交
108 109 110 111 112 113 114 115 116 117 118 119 120 121

```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)
```
P
Pan YANG 已提交
122

123
Besides executing SQL commands, system administrators can check running status, add/drop user accounts and manage the running instances. TAOS CLI with client driver can be installed and run on either Linux or Windows machines. For more details on CLI, please [check here](../reference/taos-shell/).
D
dingbo 已提交
124

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
125
## Experience the blazing fast speed
D
dingbo 已提交
126

127
After TDengine server is running,execute `taosBenchmark` (previously named taosdemo) from a Linux terminal:
D
dingbo 已提交
128 129 130 131 132

```bash
taosBenchmark
```

133
This command will create a super table "meters" under database "test". Under "meters", 10000 tables are created with names from "d0" to "d9999". Each table has 10000 rows and each row has four columns (ts, current, voltage, phase). Time stamp is starting from "2017-07-14 10:40:00 000" to "2017-07-14 10:40:09 999". Each table has tags "location" and "groupId". groupId is set 1 to 10 randomly, and location is set to "beijing" or "shanghai".
D
dingbo 已提交
134

135
This command will insert 100 million rows into the database quickly. Time to insert depends on the hardware configuration, it only takes a dozen seconds for a regular PC server.            
P
Pan YANG 已提交
136

137
taosBenchmark provides command-line options and a configuration file to customize the scenarios, like number of tables, number of rows per table, number of columns and more. Please execute `taosBenchmark --help` to list them. For details on running taosBenchmark, please check [reference for taosBenchmark](/reference/taosbenchmark)
D
dingbo 已提交
138

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
139
## Experience query speed
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
140
           
141
After using taosBenchmark to insert a number of rows data, you can execute queries from TDengine CLI to experience the lightning fast query speed.
D
dingbo 已提交
142

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
143
query the total number of rows under super table "meters":
D
dingbo 已提交
144 145 146 147 148

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

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
149
query the average, maximum, minimum of 100 million rows:
D
dingbo 已提交
150 151 152 153 154

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

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
155
query the total number of rows with location="beijing":
D
dingbo 已提交
156 157 158 159 160

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

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
161
query the average, maximum, minimum of all rows with groupId=10:
D
dingbo 已提交
162 163 164 165 166

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

P
Pan YANG 已提交
167
query the average, maximum, minimum for table d10 in 10 seconds time interval:
D
dingbo 已提交
168 169 170 171

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