03-get-started.md 7.2 KB
Newer Older
D
dingbo 已提交
1
---
D
dingbo 已提交
2
title: Get Started
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
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 server(taosd), taosAdapter for connecting with third-party systems and providing RESTful interface, client driver(taosc), command line program(CLI, taos) and some tools. For current version, the server taosd and taosAdapter can only be installed and run on Linux systems, and will support Windows, macOS and other systems in the future. The client driver taosc and TDengine CLI can be installed and run on Windows or Linux. In addition to the RESTful interface, TDengine also provides connectors for a number of programming languages. In versions before 2.4, there is no taosAdapter, and the RESTfule interface is 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">
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
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 34 35 36

```shell
docker exec -it <containrid> bash
```

陶建辉(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

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
55
If you like to check the source code, build the package by youself 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
```

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
74
If everything is fine,you can run TDengine command line interface `taos` to access TDengine and play around it.
D
dingbo 已提交
75 76 77

:::info

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
78 79
- systemctl requires _root_ privileges,if you are not _root_ ,please add sudo before the command.
- To get feedback and keep polishing the prodcut, TDengine is colleting some basic usage information, but you can turn it off by setting telemetryReporting to 0 in configuration file taos.cfg. 
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
80
- TDengine uses FQDN (usually hostname)as the ID for a node. To make 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
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
94
           
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
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>
```

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
107
Inside TDengine CLI,you can execute SQL commands to create/drop database/table, and run queries. The SQL command must be eneded 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)
```
122
Besides executing SQL commands, system administrator 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 machine. For more details on CLI, please [check here](../reference/taos-shell/).
D
dingbo 已提交
123

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

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
126
After TDengine server is running,execute `taosBenchmark`(named as taosdemo before) from a Linux terminal:
D
dingbo 已提交
127 128 129 130

```bash
taosBenchmark
```
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
131
This command will create a super table "meters" under database "test". Unde "meters", 10000 tables are created with name 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 已提交
132

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
133
This command will insert 100 million rows into database quickly. Depends on the hardware configuration, it only takes a dozen seconds for a regular PC server.            
D
dingbo 已提交
134

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
135
taosBenchmark provides you command line options and confuguration 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 已提交
136

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

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

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

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

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

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

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

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

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

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
165
query the average, maximum, minimum for table d10 in 10 seconds time interal:
D
dingbo 已提交
166 167 168 169

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