diff --git a/documentation20/cn/02.getting-started/01.docker/docs.md b/documentation20/cn/02.getting-started/01.docker/docs.md index 1ba593b12ecc3a5eac5ab6af64a2507d561cbd98..fc56ef5c4d399e20df579211fec4f5e46f9f7914 100644 --- a/documentation20/cn/02.getting-started/01.docker/docs.md +++ b/documentation20/cn/02.getting-started/01.docker/docs.md @@ -35,7 +35,7 @@ $ docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdeng 进一步,还可以使用 docker run 命令启动运行 TDengine server 的 docker 容器,并使用 `--name` 命令行参数将容器命名为 `tdengine`,使用 `--hostname` 指定 hostname 为 `tdengine-server`,通过 `-v` 挂载本地目录到容器,实现宿主机与容器内部的数据同步,防止容器删除后,数据丢失。 ```bash -$ docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log:/var/log/taos -v ~/work/taos/data:/var/lib/taos -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine +docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log:/var/log/taos -v ~/work/taos/data:/var/lib/taos -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine ``` - **--name tdengine**:设置容器名称,我们可以通过容器名称来访问对应的容器 @@ -45,7 +45,12 @@ $ docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log: ### 使用 docker ps 命令确认容器是否已经正确运行 ```bash -$ docker ps +docker ps +``` + +输出示例如下: + +``` CONTAINER ID IMAGE COMMAND CREATED STATUS ··· c452519b0f9b tdengine/tdengine "taosd" 14 minutes ago Up 14 minutes ··· ``` @@ -85,7 +90,6 @@ TDengine 终端成功连接服务端,打印出了欢迎消息和版本信息 在 TDengine 终端中,可以通过 SQL 命令来创建/删除数据库、表、超级表等,并可以进行插入和查询操作。具体可以参考 [TAOS SQL 说明文档](https://www.taosdata.com/cn/documentation/taos-sql)。 - ### 在宿主机访问 Docker 容器中的 TDengine server 在使用了 -p 命令行参数映射了正确的端口启动了 TDengine Docker 容器后,就在宿主机使用 taos shell 命令即可访问运行在 Docker 容器中的 TDengine。 @@ -102,7 +106,12 @@ taos> 也可以在宿主机使用 curl 通过 RESTful 端口访问 Docker 容器内的 TDengine server。 ``` -$ curl -u root:taosdata -d 'show databases' 127.0.0.1:6041/rest/sql +curl -u root:taosdata -d 'show databases' 127.0.0.1:6041/rest/sql +``` + +输出示例如下: + +``` {"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["test","2021-08-18 06:01:11.021",10000,4,1,1,10,"3650,3650,3650",16,6,100,4096,1,3000,2,0,"ms",0,"ready"],["log","2021-08-18 05:51:51.065",4,1,1,1,10,"30,30,30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":2} ``` @@ -119,195 +128,36 @@ TDengine RESTful 接口详情请参考[官方文档](https://www.taosdata.com/cn 使用 docker 运行 TDengine 2.4.0.4 版本镜像(taosd + taosAdapter): ```bash -$ docker run -d --name tdengine-all -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine:2.4.0.4 +docker run -d --name tdengine-all -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine:2.4.0.4 ``` 使用 docker 运行 TDengine 2.4.0.4 版本镜像(仅 taosAdapter,需要设置 firstEp 配置项 或 TAOS_FIRST_EP 环境变量): ```bash -$ docker run -d --name tdengine-taosa -p 6041-6049:6041-6049 -p 6041-6049:6041-6049/udp -e TAOS_FIRST_EP=tdengine-all tdengine/tdengine:2.4.0.4 taosadapter +docker run -d --name tdengine-taosa -p 6041-6049:6041-6049 -p 6041-6049:6041-6049/udp -e TAOS_FIRST_EP=tdengine-all tdengine/tdengine:2.4.0.4 taosadapter ``` 使用 docker 运行 TDengine 2.4.0.4 版本镜像(仅 taosd): ```bash -$ docker run -d --name tdengine-taosd -p 6030-6042:6030-6042 -p 6030-6042:6030-6042/udp -e TAOS_DISABLE_ADAPTER=true tdengine/tdengine:2.4.0.4 +docker run -d --name tdengine-taosd -p 6030-6042:6030-6042 -p 6030-6042:6030-6042/udp -e TAOS_DISABLE_ADAPTER=true tdengine/tdengine:2.4.0.4 ``` 使用 curl 命令验证 RESTful 接口可以正常工作: ```bash -$ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'show databases;' 127.0.0.1:6041/rest/sql - -{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["log","2021-12-28 09:18:55.765",10,1,1,1,10,"30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":1} -``` - -taosAdapter 支持多个数据收集代理软件(如 Telegraf、StatsD、collectd 等),这里仅模拟 StatsD 写入数据,在宿主机执行命令如下: - -```bash -$ echo "foo:1|c" | nc -u -w0 127.0.0.1 6044 -``` - -然后可以使用 taos shell 查询 taosAdapter 自动创建的数据库 statsd 和 超级表 foo 中的内容: - -```bash -taos> show databases; - name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status | -==================================================================================================================================================================================================================================================================================== - log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready | - statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready | -Query OK, 2 row(s) in set (0.002112s) - -taos> use statsd; -Database changed. - -taos> show stables; - name | created_time | columns | tags | tables | -============================================================================================ - foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 | -Query OK, 1 row(s) in set (0.001160s) - -taos> select * from foo; - ts | value | metric_type | -======================================================================================= - 2021-12-28 09:21:48.840820836 | 1 | counter | -Query OK, 1 row(s) in set (0.001639s) - -taos> -``` - -可以看到模拟数据已经被写入到 TDengine 中。 - -### 应用示例:在宿主机使用 taosBenchmark 写入数据到 Docker 容器中的 TDengine server - -1,在宿主机命令行界面执行 taosBenchmark (曾命名为 taosdemo)写入数据到 Docker 容器中的 TDengine server - -``` -$ taosBenchmark - -taosBenchmark is simulating data generated by power equipments monitoring... - -host: 127.0.0.1:6030 -user: root -password: taosdata -configDir: -resultFile: ./output.txt -thread num of insert data: 10 -thread num of create table: 10 -top insert interval: 0 -``` - -使用 curl 命令验证 RESTful 接口可以正常工作: - -``` -$ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'show databases;' 127.0.0.1:6041/rest/sql - -{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["log","2021-12-28 09:18:55.765",10,1,1,1,10,"30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":1} -``` - -taosAdapter 支持多个数据收集代理软件(如 Telegraf、StatsD、collectd 等),这里仅模拟 StasD 写入数据,在宿主机执行命令如下: - -``` -$ echo "foo:1|c" | nc -u -w0 127.0.0.1 6044 -``` - -然后可以使用 taos shell 查询 taosAdapter 自动创建的数据库 statsd 和 超级表 foo 中的内容: - -``` -taos> show databases; - name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status | -==================================================================================================================================================================================================================================================================================== - log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready | - statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready | -Query OK, 2 row(s) in set (0.002112s) - -taos> use statsd; -Database changed. - -taos> show stables; - name | created_time | columns | tags | tables | -============================================================================================ - foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 | -Query OK, 1 row(s) in set (0.001160s) - -taos> select * from foo; - ts | value | metric_type | -======================================================================================= - 2021-12-28 09:21:48.840820836 | 1 | counter | -Query OK, 1 row(s) in set (0.001639s) - -taos> -``` - -可以看到模拟数据已经被写入到 TDengine 中。 - - -### 应用示例:在宿主机使用 taosBenchmark 写入数据到 Docker 容器中的 TDengine server - -1,在宿主机命令行界面执行 taosBenchmark 写入数据到 Docker 容器中的 TDengine server - -```bash -$ taosBenchmark - -taosBenchmark is simulating data generated by power equipments monitoring... - -host: 127.0.0.1:6030 -user: root -password: taosdata -configDir: -resultFile: ./output.txt -thread num of insert data: 10 -thread num of create table: 10 -top insert interval: 0 +curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'show databases;' 127.0.0.1:6041/rest/sql ``` -使用 curl 命令验证 RESTful 接口可以正常工作: +输出示例如下: ``` -$ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'show databases;' 127.0.0.1:6041/rest/sql - {"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["log","2021-12-28 09:18:55.765",10,1,1,1,10,"30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":1} ``` -taosAdapter 支持多个数据收集代理软件(如 Telegraf、StatsD、collectd 等),这里仅模拟 StasD 写入数据,在宿主机执行命令如下: -``` -$ echo "foo:1|c" | nc -u -w0 127.0.0.1 6044 -``` - -然后可以使用 taos shell 查询 taosAdapter 自动创建的数据库 statsd 和 超级表 foo 中的内容: - -``` -taos> show databases; - name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status | -==================================================================================================================================================================================================================================================================================== - log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready | - statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready | -Query OK, 2 row(s) in set (0.002112s) - -taos> use statsd; -Database changed. - -taos> show stables; - name | created_time | columns | tags | tables | -============================================================================================ - foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 | -Query OK, 1 row(s) in set (0.001160s) - -taos> select * from foo; - ts | value | metric_type | -======================================================================================= - 2021-12-28 09:21:48.840820836 | 1 | counter | -Query OK, 1 row(s) in set (0.001639s) - -taos> -``` - -可以看到模拟数据已经被写入到 TDengine 中。 - - ### 应用示例:在宿主机使用 taosBenchmark 写入数据到 Docker 容器中的 TDengine server -1,在宿主机命令行界面执行 taosBenchmark 写入数据到 Docker 容器中的 TDengine server +1,在宿主机命令行界面执行 taosBenchmark (曾命名为 taosdemo)写入数据到 Docker 容器中的 TDengine server ```bash $ taosBenchmark @@ -361,7 +211,7 @@ column[0]:FLOAT column[1]:INT column[2]:FLOAT 最后共插入 1 亿条记录。 -2,进入 TDengine 终端,查看 taosBenchmark 生成的数据。 +2.进入 TDengine 终端,查看 taosBenchmark 生成的数据。 - **进入命令行。** @@ -380,7 +230,7 @@ taos> $ taos> show databases; name | created_time | ntables | vgroups | ··· test | 2021-08-18 06:01:11.021 | 10000 | 6 | ··· - log | 2021-08-18 05:51:51.065 | 4 | 1 | ··· + log | 2021-08-18 05:51:51.065 | 4 | 1 | ··· ``` @@ -429,16 +279,51 @@ $ taos> select groupid, location from test.d0; ================================= 0 | shanghai | Query OK, 1 row(s) in set (0.003490s) +``` + +### 应用示例:使用数据收集代理软件写入 TDengine + +taosAdapter 支持多个数据收集代理软件(如 Telegraf、StatsD、collectd 等),这里仅模拟 StasD 写入数据,在宿主机执行命令如下: + +``` +echo "foo:1|c" | nc -u -w0 127.0.0.1 6044 +``` + +然后可以使用 taos shell 查询 taosAdapter 自动创建的数据库 statsd 和 超级表 foo 中的内容: ``` +taos> show databases; + name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status | +==================================================================================================================================================================================================================================================================================== + log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready | + statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready | +Query OK, 2 row(s) in set (0.002112s) + +taos> use statsd; +Database changed. + +taos> show stables; + name | created_time | columns | tags | tables | +============================================================================================ + foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 | +Query OK, 1 row(s) in set (0.001160s) + +taos> select * from foo; + ts | value | metric_type | +======================================================================================= + 2021-12-28 09:21:48.840820836 | 1 | counter | +Query OK, 1 row(s) in set (0.001639s) + +taos> +``` + +可以看到模拟数据已经被写入到 TDengine 中。 ## 停止正在 Docker 中运行的 TDengine 服务 ```bash -$ docker stop tdengine -tdengine +docker stop tdengine ``` - **docker stop**:通过 docker stop 停止指定的正在运行中的 docker 镜像。 -- **tdengine**:容器名称。 diff --git a/documentation20/cn/02.getting-started/docs.md b/documentation20/cn/02.getting-started/docs.md index c254c59fbf915ccad21874fb24ae3c2b115e7b1f..2cd9177ee018e91a992e9d37514eb9cd095a8cde 100644 --- a/documentation20/cn/02.getting-started/docs.md +++ b/documentation20/cn/02.getting-started/docs.md @@ -12,6 +12,10 @@ TDengine 软件分为服务器、客户端和报警模块三部分,目前 2.0 暂时不建议生产环境采用 Docker 来部署 TDengine 的客户端或服务端,但在开发环境下或初次尝试时,使用 Docker 方式部署是十分方便的。特别是,利用 Docker,可以方便地在 Mac OS X 和 Windows 环境下尝试 TDengine。 +``` +docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine +``` + 详细操作方法请参照 [通过 Docker 快速体验 TDengine](https://www.taosdata.com/cn/documentation/getting-started/docker)。 ### 通过安装包安装 @@ -25,6 +29,7 @@ TDengine 的安装非常简单,从下载到安装成功仅仅只要几秒钟 ### 使用 apt-get 安装 如果使用 Debian 或 Ubuntu 系统,也可以使用 apt-get 从官方仓库安装,设置方法为: + ``` 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 @@ -44,13 +49,14 @@ $ systemctl start taosd ``` 检查服务是否正常工作: + ```bash $ systemctl status taosd ``` -如果 TDengine 服务正常工作,那么您可以通过 TDengine 的命令行程序 `taos` 来访问并体验 TDengine。 +如果 TDengine 服务正常工作,那么您可以通过 TDengine 的命令行程序 `taos` 来访问并体验 TDengine。 -**注意:** +### 注意: - systemctl 命令需要 _root_ 权限来运行,如果您非 _root_ 用户,请在命令前添加 sudo 。 - 为更好的获得产品反馈,改善产品,TDengine 会采集基本的使用信息,但您可以修改系统配置文件 taos.cfg 里的配置参数 telemetryReporting,将其设为 0,就可将其关闭。 @@ -98,7 +104,7 @@ Query OK, 2 row(s) in set (0.003128s) 除执行 SQL 语句外,系统管理员还可以从 TDengine 终端进行检查系统运行状态、添加删除用户账号等操作。 -**命令行参数** +### 命令行参数 您可通过配置命令行参数来改变 TDengine 终端的行为。以下为常用的几个命令行参数: @@ -115,7 +121,7 @@ Query OK, 2 row(s) in set (0.003128s) $ taos -h h1.taos.com -s "use db; show tables;" ``` -**运行 SQL 命令脚本** +### 运行 SQL 命令脚本 TDengine 终端可以通过 `source` 命令来运行 SQL 命令脚本。 @@ -123,7 +129,7 @@ TDengine 终端可以通过 `source` 命令来运行 SQL 命令脚本。 taos> source ; ``` -**Shell 小技巧** +### taos shell 小技巧 - 可以使用上下光标键查看历史输入的指令 - 修改用户密码:在 shell 中使用 `alter user` 命令,缺省密码为 taosdata @@ -175,9 +181,10 @@ taos> select avg(current), max(voltage), min(phase) from test.meters where group ```mysql taos> select avg(current), max(voltage), min(phase) from test.d10 interval(10s); ``` + ## taosBenchmark 详细功能列表 -taosBenchmark 命令本身带有很多选项,配置表的数目、记录条数等等,请执行 `taosBenchmark --help` 详细列出。您可以设置不同参数进行体验。 +taosBenchmark (曾命名 taosdemo)命令本身带有很多选项,配置表的数目、记录条数等等,请执行 `taosBenchmark --help` 详细列出。您可以设置不同参数进行体验。 taosBenchmark 详细使用方法请参照 [如何使用taosBenchmark对TDengine进行性能测试](https://www.taosdata.com/2021/10/09/3111.html)。 ## 客户端 diff --git a/documentation20/en/02.getting-started/01.docker/docs.md b/documentation20/en/02.getting-started/01.docker/docs.md index 780d8e70b8103cc95bf74ff6221fdaa71d4e8535..f5d48db8abe99b96bc565bc5daf03b4f758060c7 100644 --- a/documentation20/en/02.getting-started/01.docker/docs.md +++ b/documentation20/en/02.getting-started/01.docker/docs.md @@ -1,4 +1,4 @@ -# Quickly experience TDengine through Docker +# Quickly experience TDengine with Docker While it is not recommended to deploy TDengine services via Docker in a production environment, Docker tools do a good job of shielding the environmental differences in the underlying operating system and are well suited for use in development testing or first-time experience with the toolset for installing and running TDengine. In particular, Docker makes it relatively easy to try TDengine on Mac OSX and Windows systems without having to install a virtual machine or rent an additional Linux server. In addition, starting from version 2.0.14.0, TDengine provides images that support both X86-64, X86, arm64, and arm32 platforms, so non-mainstream computers that can run docker, such as NAS, Raspberry Pi, and embedded development boards, can also easily experience TDengine based on this document. @@ -20,7 +20,7 @@ Docker version 20.10.3, build 48d30b5 ### running TDengine server inside Docker ```bash -$ docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine +docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine 526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd ``` @@ -35,7 +35,7 @@ This command starts a docker container with TDengine server running and maps the Further, you can also use the `docker run` command to start the docker container running TDengine server, and use the `--name` command line parameter to name the container tdengine, use `--hostname` to specify the hostname as tdengine-server, and use `-v` to mount the local directory (-v) to synchronize the data inside the host and the container to prevent data loss after the container is deleted. ``` -$ docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log:/var/log/taos -v ~/work/taos/data:/var/lib/taos -p 6030-6041:6030-6041 -p 6030-6041:6030-6041/udp tdengine/tdengine +docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log:/var/log/taos -v ~/work/taos/data:/var/lib/taos -p 6030-6041:6030-6041 -p 6030-6041:6030-6041/udp tdengine/tdengine ``` - **--name tdengine**: set the container name, we can access the corresponding container by container name @@ -45,7 +45,12 @@ $ docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log: ### Use the `docker ps` command to verify that the container is running correctly ```bash -$ docker ps +docker ps +``` + +The output could be: + +``` CONTAINER ID IMAGE COMMAND CREATED STATUS ··· c452519b0f9b tdengine/tdengine "taosd" 14 minutes ago Up 14 minutes ··· ``` @@ -61,7 +66,7 @@ c452519b0f9b tdengine/tdengine "taosd" 14 minutes ago Up 14 minutes · ```bash $ docker exec -it tdengine /bin/bash -root@tdengine-server:~/TDengine-server-2.4.0.4# +root@tdengine-server:~/TDengine-server-2.4.0.4# ``` - **docker exec**: Enter the container by `docker exec` command, if exited, the container will not stop. @@ -78,7 +83,7 @@ root@tdengine-server:~/TDengine-server-2.4.0.4# taos Welcome to the TDengine shell from Linux, Client Version:2.4.0.4 Copyright (c) 2020 by TAOS Data, Inc. All rights reserved. -taos> +taos> ``` The TDengine shell successfully connects to the server and prints out a welcome message and version information. If it fails, an error message is printed. @@ -101,7 +106,12 @@ taos> You can also access the TDengine server inside the Docker container using `curl` command from the host side through the RESTful port. ``` -$ curl -u root:taosdata -d 'show databases' 127.0.0.1:6041/rest/sql +curl -u root:taosdata -d 'show databases' 127.0.0.1:6041/rest/sql +``` + +The output could be: + +``` {"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["test","2021-08-18 06:01:11.021",10000,4,1,1,10,"3650,3650,3650",16,6,100,4096,1,3000,2,0,"ms",0,"ready"],["log","2021-08-18 05:51:51.065",4,1,1,1,10,"30,30,30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":2} ``` @@ -109,7 +119,6 @@ This command accesses the TDengine server through the RESTful interface, which c TDengine RESTful interface details can be found in the [official documentation](https://www.taosdata.com/en/documentation/connector#restful). - ### Running TDengine server and taosAdapter with a Docker container Docker containers of TDegnine version 2.4.0.0 and later include a component named `taosAdapter`, which supports data writing and querying capabilities to the TDengine server through the RESTful interface and provides the data ingestion interfaces compatible with InfluxDB/OpenTSDB. Allows seamless migration of InfluxDB/OpenTSDB applications to access TDengine. @@ -121,54 +130,25 @@ Running TDengine version 2.4.0.4 image with docker. Start taosAdapter and taosd by default: ``` -$ docker run -d --name tdengine-taosa -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine:2.4.0.4 +docker run -d --name tdengine-taosa -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine:2.4.0.4 ``` Verify that the RESTful interface taosAdapter provides working using the `curl` command. -``` -$ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'show databases;' 127.0.0.1:6041/rest/sql -{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["log","2021-12-28 09:18:55.765",10,1,1,1,10,"30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":1} ``` - -taosAdapter supports multiple data collection agents (e.g. Telegraf, StatsD, collectd, etc.), here only demonstrate how StasD is simulated to write data, and the command is executed from the host side as follows. -``` -$ echo "foo:1|c" | nc -u -w0 127.0.0.1 6044 +curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'show databases;' 127.0.0.1:6041/rest/sql ``` -Then you can use the taos shell to query the taosAdapter automatically created database statsd and the contents of the super table foo. -``` -taos> show databases; - name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status | -==================================================================================================================================================================================================================================================================================== - log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready | - statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready | -Query OK, 2 row(s) in set (0.002112s) - -taos> use statsd; -Database changed. - -taos> show stables; - name | created_time | columns | tags | tables | -============================================================================================ - foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 | -Query OK, 1 row(s) in set (0.001160s) - -taos> select * from foo; - ts | value | metric_type | -======================================================================================= - 2021-12-28 09:21:48.840820836 | 1 | counter | -Query OK, 1 row(s) in set (0.001639s) +The output could be: -taos> ``` - -You can see that the simulation data has been written to TDengine. - +{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["log","2021-12-28 09:18:55.765",10,1,1,1,10,"30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":1} +``` ### Application example: write data to TDengine server in Docker container using taosBenchmark on the host -1, execute `taosBenchmark` (was named taosdemo) in the host command line interface to write data to the TDengine server in the Docker container +1. execute `taosBenchmark` (was named taosdemo) in the host command line interface to write data to the TDengine server in the Docker container + ```bash $ taosBenchmark @@ -177,7 +157,7 @@ taosBenchmark is simulating data generated by power equipments monitoring... host: 127.0.0.1:6030 user: root password: taosdata -configDir: +configDir: resultFile: ./output.txt thread num of insert data: 10 thread num of create table: 10 @@ -206,13 +186,13 @@ database[0]: maxSqlLen: 1048576 timeStampStep: 1 startTimestamp: 2017-07-14 10:40:00.000 - sampleFormat: - sampleFile: - tagsFile: + sampleFormat: + sampleFile: + tagsFile: columnCount: 3 -column[0]:FLOAT column[1]:INT column[2]:FLOAT +column[0]:FLOAT column[1]:INT column[2]:FLOAT tagCount: 2 - tag[0]:INT tag[1]:BINARY(16) + tag[0]:INT tag[1]:BINARY(16) Press enter key to continue or Ctrl-C to stop ``` @@ -221,7 +201,7 @@ After enter, this command will automatically create a super table `meters` under It takes about a few minutes to execute this command and ends up inserting a total of 100 million records. -3, Go to the TDengine terminal and view the data generated by taosBenchmark. +2.Go to the TDengine terminal and view the data generated by taosBenchmark. - **Go to the terminal interface.** @@ -231,7 +211,7 @@ $ root@c452519b0f9b:~/TDengine-server-2.4.0.4# taos Welcome to the TDengine shell from Linux, Client Version:2.4.0.4 Copyright (c) 2020 by TAOS Data, Inc. All rights reserved. -taos> +taos> ``` - **View the database.** @@ -240,7 +220,7 @@ taos> $ taos> show databases; name | created_time | ntables | vgroups | ··· test | 2021-08-18 06:01:11.021 | 10000 | 6 | ··· - log | 2021-08-18 05:51:51.065 | 4 | 1 | ··· + log | 2021-08-18 05:51:51.065 | 4 | 1 | ··· ``` @@ -292,13 +272,49 @@ Query OK, 1 row(s) in set (0.003490s) ``` +### Application Example: use data collection agent to write data into TDengine + +taosAdapter supports multiple data collection agents (e.g. Telegraf, StatsD, collectd, etc.), here only demonstrate how StasD is simulated to write data, and the command is executed from the host side as follows. + +``` +echo "foo:1|c" | nc -u -w0 127.0.0.1 6044 +``` + +Then you can use the taos shell to query the taosAdapter automatically created database statsd and the contents of the super table foo. + +``` +taos> show databases; + name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status | +==================================================================================================================================================================================================================================================================================== + log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready | + statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready | +Query OK, 2 row(s) in set (0.002112s) + +taos> use statsd; +Database changed. + +taos> show stables; + name | created_time | columns | tags | tables | +============================================================================================ + foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 | +Query OK, 1 row(s) in set (0.001160s) + +taos> select * from foo; + ts | value | metric_type | +======================================================================================= + 2021-12-28 09:21:48.840820836 | 1 | counter | +Query OK, 1 row(s) in set (0.001639s) + +taos> +``` + +You can see that the simulation data has been written to TDengine. + ## Stop the TDengine service that is running in Docker ```bash -$ docker stop tdengine -tdengine +docker stop tdengine ``` - **docker stop**: Stop the specified running docker image with docker stop. -- **tdengine**: The name of the container. diff --git a/documentation20/en/02.getting-started/docs.md b/documentation20/en/02.getting-started/docs.md index 29ca540e6e9bae6ffa7fbb7e0671889ccdf94375..21149f09e9f88555b0767cad76926d0eac406bab 100644 --- a/documentation20/en/02.getting-started/docs.md +++ b/documentation20/en/02.getting-started/docs.md @@ -12,7 +12,11 @@ Please visit our [TDengine github page](https://github.com/taosdata/TDengine) fo For the time being, it is not recommended to use Docker to deploy the client or server side of TDengine in production environments, but it is convenient to use Docker to deploy in development environments or when trying it for the first time. In particular, with Docker, it is easy to try TDengine in Mac OS X and Windows environments. -Please refer to the detailed operation in [Quickly experience TDengine through Docker](https://www.taosdata.com/en/documentation/getting-started/docker). +``` +docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine +``` + +Please refer to [Quickly experience TDengine with Docker](https://www.taosdata.com/en/documentation/getting-started/docker) for the details. ### Install from Package @@ -54,8 +58,8 @@ If the service is running successfully, you can play around through TDengine she - The `systemctl` command needs the **root** privilege. Use **sudo** if you are not the **root** user. - To get better product feedback and improve our solution, TDengine will collect basic usage information, but you can modify the configuration parameter **telemetryReporting** in the system configuration file taos.cfg, and set it to 0 to turn it off. - TDengine uses FQDN (usually hostname) as the node ID. In order to ensure normal operation, you need to set hostname for the server running taosd, and configure DNS service or hosts file for the machine running client application, to ensure the FQDN can be resolved. -- TDengine supports installation on Linux systems with[ systemd ](https://en.wikipedia.org/wiki/Systemd)as the process service management, and uses `which systemctl` command to detect whether `systemd` packages exist in the system: - +- TDengine supports installation on Linux systems with [systemd](https://en.wikipedia.org/wiki/Systemd) as the process service management, and uses `which systemctl` command to detect whether `systemd` packages exist in the system: + ```bash $ which systemctl ``` @@ -140,7 +144,7 @@ taos> source ; After starting the TDengine server, you can execute the command `taosBenchmark` (was named `taosdemo`, please install taosTools package if you use TDengine 2.4 or later version) in the Linux terminal. -```bash +```bash $ taosBenchmark ``` @@ -213,7 +217,7 @@ List of platforms supported by TDengine server | Allwinner ARM64 | | | ○ | | | | | Actions ARM64 | | | ○ | | | | -Note: ● has been verified by official tests; ○ has been verified by unofficial tests. +Note: ● has been verified by official tests; ○ has been verified by unofficial tests. List of platforms supported by TDengine client and connectors